Currently we are creating a new environment and are running into some quirks with SSL. We are using an ELB that accepts 80/443. Both route to the same port on an Nginx box (ELB Decrypts). On the Nginx box we are checking for the AWS header and if we do not see it we redirect back to https. So far though the redirect isn't working.
Below is a copy of our nginx config file for the site that is listening on port 3000 (ELB 80->3000. ELB 443->3000).
server {
listen 80;
root /home/app/web-app/public;
passenger_enabled on;
passenger_user app;
# If this is a Ruby app, specify a Ruby version:
passenger_ruby /usr/bin/ruby2.2;
passenger_min_instances 2;
if ($http_x_forwarded_proto != "https") {
return 301 https://$host$request_uri;
}
}
Any thoughts on what I'm doing wrong here?
EDIT -
We are using the passenger docker image as seen here - https://github.com/phusion/passenger-docker
Passenger starts up and seems to take in all requests on port 3000 despite what the Nginx config shows of listen 80.
@TJSaunders had me on the right track. I was running passenger stand alone via bundle exec which was bypassing Nginx. Once I realized this error and shifted my docker file to instead start Nginx it started hitting the config files.
You may need to tell passenger to pass along those headers, e.g.:
The
passenger_pass_header
docs mention that some headers are not passed along, and that this directive is needed.Hope this helps!