Sign up ×
Server Fault is a question and answer site for 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/ fail_timeout=0;
    # ...

server {

    # ...

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

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

1 Answer 1

up vote 0 down vote accepted

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

Your Answer


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.