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?


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.

  • 1
    If your nginx process is listening on port 3000, shouldn't the nginx config use "listen 3000;" instead of "listen 80;"? – Castaglia Feb 16 '16 at 21:29
  • Seems to be more to it than that. I am using Docker with the passenger image that boots off of port 3000. I hadn't noticed this discrepancy but oddly enough my application loads fine. – CogitoErgoSum Feb 16 '16 at 22:13

@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.

| improve this answer | |

You may need to tell passenger to pass along those headers, e.g.:

passenger_pass_header X-Forwarded-For;
passenger_pass_header X-Forwarded-Proto;

The passenger_pass_header docs mention that some headers are not passed along, and that this directive is needed.

Hope this helps!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.