I've looked through the many related posts on this but I'm not understanding where I'm going wrong.
What I want is for all http
, https
and mydomain.com
and www.mydomain.com
requests to go to https://www.mydomain.com
(Similar to this person)
I've checked my SSL certificate and it says it's for www.mydomain.com. I've checked the certificate if I go to mydomain.com or www.mydomain.com and it seems to give the same info, and both seem to be secure (little green lock).
I tried the solution on this post, but got the following error:
Restarting nginx: nginx: [emerg] invalid parameter "443" in /path/nginx/sites-enabled/example:3
The problem I'm having is that users sign in on the www.mydomain.com page and for some reason, they are redirected to the mydomain.com page and they then appear logged out and need to log in again. To be honest, I'm not sure if this is a rails issue or an nginx config issue.
My nginx config file is below:
server {
listen 80;
server_name mydomain.com www.mydomain.com;
return 301 https://www.mydomain.com$request_uri;
}
server {
listen 443 ssl default;
server_name www.mydomain.com;
...other stuff...
}
I'd really appreciate the help. I'm baffled.