I have a ruby on rails application setup on AWS elastic beanstalk using nginx and puma, my requirement is to redirect all my requests from http://example.com
or http://www.example.com
or https://example.com
to https://www.example.com
. Also I don't want request from my subdomains to be redirected to www, like I don't want http://subdomain.example.com
to be redirected to https://www.expample.com
or https://www.subdomain.example.com
.
Using the link
I was able to redirect all my requests from http to https but this does not redirect non www to www requests.