We're Hiring!

Mattermost Discussion Forums

Redirect users to WWW

Hey guys, im currently in the middle of a migration from Slack to Mattermost. Setup was very easy apart from issues during data migration, but i got there after a few more hours of playing around, so not too bad!

One issue im having is that the users are imported from Slack, however obviously their password’s were not pulled over. Users are having to do password resets which is all fine. however if a user goes to the non-www version of the site, for example h t t p s://domain.com, they see an Nginx 502 error after trying to reset. if they use h t t p s://w w w.domain.com to do it, it works fine.

I have redirects set up to force http users to https, but how can i force them to www?

In /etc/nginx/sites-available i have this setup already, but it doesnt seem to do the job

default

server {
   listen 80;
   server_name domain.com;
   return 301 h t t p s://w w w.domain.com:443$request_uri;

and

mattermost.conf

server {
    listen 80 default_server;
    server_name _;
   return 301 h t t p s://w w w.domain.com:443$request_uri;
}

Im sure its something simple, buit am fed up of keep breaking Nginx and having to go back to the start, so thought id ask the experts!

BTW, in the example above, ive substituted domain.com for my actual domain. and add to add spaces between the H t t p s parts as “new users can only post 2 links”, im not trying to post links so ive worked around it.