Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This is my nginx configuration:

upstream local_thin_cluster {
    server 127.0.0.1:3000;
    server 127.0.0.1:3001;
}

server {
    #listen   80;

    access_log /usr/share/redmine/log/nginx_access.log;
    error_log  /usr/share/redmine/log/nginx_error.log;

    root    /usr/share/redmine/public;
    proxy_redirect  off;

    location / {
        proxy_set_header  X-Real-IP  $remote_addr;
        proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header  Host $http_host;

        try_files $uri $uri/index.html $uri.html @cluster;
    }

    location @cluster {
        proxy_pass http://local_thin_cluster ;
    }
}

The problem I have is that after login redirection in web application (redmine) I get the address http://local_thin_cluster/my/page.

Everything works fine on thin server.

How can I fix this so that it redirects to the same server_name/ip on which it received request. I could fix it by putting IP instead of local_thin_cluster but I don't want to hard code server_name/ip because I need to install this on several machines and need as simple configuration as possible.

share|improve this question
add comment

1 Answer 1

It started working once I moved @proxy_redirect off;@ to @location@ section.

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.