I am trying to redirect non-www requests to www, but it appears that either my Nginx config is not running the redirect in the below server block or the fact that SSL is enabled, but not for the non-www site is blocking the redirect from happening.
The following is in place which makes me think the setup is correct, but I noticed the following scenarios:
- http://example.com redirects to https://example.com = warning for unsafe connection because no name certificates
- https://example.com = warning for unsafe connection because no name certificates
- http://www.example.com redirects to https://www.example.com = Successful redirect and site loads
- https://www.example.com = Site loads
The following are in place:
- I have name certificates for
- www.example.com A ALIAS "my-elasticbeanstalk-address"
- example.com A ALIAS "www.example.com record"
And here is my config (redirecting http requests to https and www):
Am I missing something? Should the server block be a different setup?