Welcome! Log In Create A New Profile

Advanced

Re: Nginx removes X-Client-IP header added by loadbalancer

Francis Daly
December 08, 2012 02:16PM
On Sat, Dec 08, 2012 at 01:20:12PM -0500, mrtn wrote:

Hi there,

> However, if the request is first routed to Nginx and then to the application
> server using:
>
> proxy_pass http://127.0.0.1:8080;
> proxy_redirect off;
>
> then the 'X-Client-IP' header is missing from the request when it reaches
> Tornado. I guess I might need to explicitly add this header in Nginx as
> well, so it can relay it on. What is the right solution here?

It seems to work for me.

Can you provide an nginx.conf and nginx -V output that shows the problem?

When I use

===
server {
listen 8000;

location / {
proxy_pass http://127.0.0.1:8080;
proxy_redirect off;
}
}
===

and try

curl -i -A "" -H X-Client-IP:1.2.3.4 http://localhost:8000/

then I can see in tcpdump output going to port 8080:

===
GET / HTTP/1.0
Host: 127.0.0.1:8080
Connection: close
Accept: */*
X-Client-IP: 1.2.3.4

===

This is with nginx/1.2.4.

What's different in your setup?

f
--
Francis Daly francis@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx removes X-Client-IP header added by loadbalancer

mrtn December 08, 2012 01:20PM

Re: Nginx removes X-Client-IP header added by loadbalancer

Francis Daly December 08, 2012 02:16PM

Re: Nginx removes X-Client-IP header added by loadbalancer

Maxim Dounin December 09, 2012 07:48PM

Re: Nginx removes X-Client-IP header added by loadbalancer

mrtn December 09, 2012 08:30PM

Re: Nginx removes X-Client-IP header added by loadbalancer

Maxim Dounin December 09, 2012 10:00PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 292
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready