Much like my previous post on redirect HTTP to HTTPS for IIS behind AWS’s Elastic Load Balancer, I started googling around for a solution for nginx. What I’ve put in place works when placed in the server directive for HTTP traffic:
if ($http_x_forwarded_proto != 'https') {
rewrite ^(.*) https://$host$1 permanent;
}
However, am wondering if there’s a better/cleaner way to do this? Acknowledging this nginx wiki entry..