1

How to setup nginx to redirect to https for certain host when behind an SSL termination load balancer

view story
linux-howto

http://serverfault.com – Hello I have a web server (running nginx) in EC2 behind an ELB (load balancer) which terminates SSL connections. If there is a request to www.domain.com it will go http to the ELB and be passed to http on the nginx server If there is a request to secure.domain.com it should go to https to the ELB and be passed to http to the nginx server. If a request comes in http://secure.domain.com I would like nginx to do a 301 redirect to https://secure.domain.com. I can accomplish this by using the http_X_Forwarded_Proto header that is injected by the ELB. So something like server { listen (HowTos)