Nginx changes "Location" header passed by backend

Hello,

I’ve quoted two sets of reply headers for the same request. The first
was the reply of the backend server, captured by tcpdump. The second is
the reply of the nginx server as captured by Firebug. Could anyone tell
me why nginx changed the location header and what I can do about it?
There is no rule in the configuration to do so. The addition of the
“X-Backend-Server” and X-UA-Compatible" headers are correct, though.

Request w/o cookie as seen by apache backend:
GET /test.php HTTP/1.0
Host: secure.firma.de
X-Remote-Address: 91.52.189.31
Connection: close
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.3)
Gecko/20100415 Ubuntu/10.04 (lucid) Firefox/3.6.3
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: de-de,de;q=0.8,en-gb;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Apache Backend Reply:
HTTP/1.1 302 Found
Date: Thu, 22 Apr 2010 10:24:31 GMT
Server: Apache/2.2.9 (Debian)
Location: Einfach Gründen - firma.de
X-Backend-Server: schiller
Content-Length: 0
Connection: close
Content-Type: text/html

nginx Reply:
HTTP/1.1 302 Found
Server: nginx/0.7.60
Date: Thu, 22 Apr 2010 10:24:31 GMT
Content-Type: text/html
Location: https://secure.firma.de/test2.php
Connection: keep-alive
X-Backend-Server: schiller
Content-Length: 0
X-UA-Compatible: IE=EmulateIE7

Thanks for help.

Posted at Nginx Forum:

Hello!

On Thu, Apr 22, 2010 at 07:00:04AM -0400, Rabenschwinge wrote:

Hello,

I’ve quoted two sets of reply headers for the same request. The
first was the reply of the backend server, captured by tcpdump.
The second is the reply of the nginx server as captured by
Firebug. Could anyone tell me why nginx changed the location
header and what I can do about it? There is no rule in the
configuration to do so. The addition of the “X-Backend-Server”
and X-UA-Compatible" headers are correct, though.

http://wiki.nginx.org/NginxHttpProxyModule#proxy_redirect

Maxim D.

Thanks. I just added “proxy_redirect off” in the http block and now it
works as intended.

Posted at Nginx Forum: