I used passenger standalone for my app. currently my app is running on both http and https . i want to redirect all http request to https. I used load balancer in my application. I read this articles
https://aws.amazon.com/premiumsupport/knowledge-center/redirect-http-https-elb/
https://www.phusionpassenger.com/library/config/standalone/intro.html#nginx-configuration-template
i tried this 2 methods
1)
if ($http_x_forwarded_proto = "http") {
return 301 https://$host$request_uri;
}
2)
if ($http_x_forwarded_proto != "https") {
rewrite ^(.*)$ https://$server_name$REQUEST_URI permanent;
}
i tried all process in same way. but every time it goes in to infinite loop and before i start passenger the instance terminate itself and create new instance because of too many request timeout.
I can't figure out, whether it is issue of elastic load balancer or passenger config. I think when i stop passenger and user try to access app. the request time out generated and due to that new instance created. i am not sure.
Thanks in advance :)