Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the following setup to process certain domains with rails via unicorn:

http {
    # ...
    upstream unicorn_server {
        # This is the socket we configured in app's config unicorn.rb
        server unix:/var/www/foo.bar.com/tmp/sockets/unicorn.sock fail_timeout=0;
    }
    # ...
}


server {
    listen foo.bar.com:80;
    server_name foo.bar.com;

    # ...

    location / {
        if (!-f $request_filename) {
            proxy_pass http://unicorn_server;
            break;
        }
    }
}

While Chrome does handle it properly (shows the rails app), Firefox and possibly other browsers are redirected to http://unicorn_server (the unicorn upstream is not invoked). Can you please tell me what am I missing here?

nginx: nginx version: nginx/1.0.10, unicorn v4.2.0

share|improve this question
add comment

1 Answer

Seems like

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

are not included by default. That did the job.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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