# Nginx changes "Location" header passed by backend

**URL:** <https://www.ruby-forum.com/t/nginx-changes-location-header-passed-by-backend/187386>\
**Category:** NGINX\
**Created:** [April 22, 2010, 1:00pm UTC](https://www.ruby-forum.com/t/nginx-changes-location-header-passed-by-backend/187386 "2010-04-22T13:00:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rabenschwinge](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/71c47a/32.png) [@Rabenschwinge](https://www.ruby-forum.com/u/Rabenschwinge)\
**Post date:** [April 22, 2010, 1:00pm UTC](https://www.ruby-forum.com/t/nginx-changes-location-header-passed-by-backend/187386/1 "2010-04-22T13:00:34Z")

</div>

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](http://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](http://www.firma.de/test2.php)  
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](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:

> **[nginx changes "Location" header passed by backend](https://forum.nginx.org/read.php?2,77967,77967#msg-77967)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![Rabenschwinge](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/71c47a/32.png) [@Rabenschwinge](https://www.ruby-forum.com/u/Rabenschwinge)\
**Post date:** [April 22, 2010, 1:09pm UTC](https://www.ruby-forum.com/t/nginx-changes-location-header-passed-by-backend/187386/2 "2010-04-22T13:09:56Z")

</div>

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.

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

Maxim D.

---

<div class="post-metadata">

**Author:** ![Rabenschwinge](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/71c47a/32.png) [@Rabenschwinge](https://www.ruby-forum.com/u/Rabenschwinge)\
**Post date:** [April 22, 2010, 1:38pm UTC](https://www.ruby-forum.com/t/nginx-changes-location-header-passed-by-backend/187386/3 "2010-04-22T13:38:03Z")

</div>

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

Posted at Nginx Forum:

> **[Re: nginx changes "Location" header passed by backend](https://forum.nginx.org/read.php?2,77967,77976#msg-77976)**
>
> 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...
