Project

General

Profile

Redmine on nginx redirect missing port number

Added by red nine almost 12 years ago

Hi,
I just upgraded my redmine to the latest release and noticed that whenever I update, create or delete I get Status Code: 404. But then I realized that the redirect to address was missing the port number.

When I access an issue the link in the address bar is example.xyz.com:1234/issues/1 and when I update the issue and click submit redmine redirects to example.xyz.com/issues/1 which shows

Status Code: 404

Exception: 
Stacktrace:
(none)

Env details

Environment:
  Redmine version                          2.2.2.stable
  Ruby version                             1.9.3 (x86_64-linux)
  Rails version                            3.2.11
  Environment                              production
  Database adapter                         PostgreSQL
Redmine plugins:
  no plugin installed

My nginix conf

server {
    listen 1234;
    server_name example.xyz.com;

    access_log  /var/log/nginx/redmine-proxy-access;
    error_log  /var/log/nginx/redmine-proxy-error;

    location / {
            .
            .
            .
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_redirect off;
    }

In the production log I see this

Processing by IssuesController#update as HTML
    .
    .
    .
Redirected to http://example.xyz.com/issues/1

I tried to look this up and tried a lot of different config options including http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Nginx_to_run_Redmine
but could not get past this issue.

What is wrong with this configuration? Thanks in advance

PS: Used 1234 port number just as an example here.


Replies (2)

RE: Redmine on nginx redirect missing port number - Added by red nine almost 12 years ago

Had to do it the hard way by trial and error but found out that the only change needed in the nginx conf was

server {
    listen 1234;
    server_name example.xyz.com;

    access_log  /var/log/nginx/redmine-proxy-access;
    error_log  /var/log/nginx/redmine-proxy-error;

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

so basically changing
proxy_set_header Host $host; to
proxy_set_header Host $http_host;

Hope this helps. Thanks!

    (1-2/2)