I have a signup page on a subdomain like: https://signup.example.com
It should only be accessible via HTTPS but I'm worried people might somehow stumble upon it via HTTP and get a 404.
My html/server block in nginx looks like this:
html {
server {
listen 443;
server_name signup.example.com;
ssl on;
ssl_certificate /path/to/my/cert;
ssl_certificate_key /path/to/my/key;
ssl_session_timeout 30m;
location / {
root /path/to/my/rails/app/public;
index index.html;
passenger_enabled on;
}
}
}
What can I add so that people who go to http://signup.example.com
get redirected to https://signup.example.com
? (FYI I know there are Rails plugins that can force SSL
but was hoping to avoid that)