Welcome! Log In Create A New Profile

Advanced

Re: set arbitrary http header?

Francis Daly
February 01, 2013 03:42PM
On Fri, Feb 01, 2013 at 02:57:00PM -0500, zacharyalexstern wrote:
> I'd like nginx to set a header that contains the IP address of the server
> nginx is running on.

There is (almost certainly) not exactly one IP address that fits that
description.

Maybe $server_addr is adequate?

Easiest is probably "proxy_set_header X-Nginx-IP 10.11.12.13;" on the
server that you want to identify as 10.11.12.13.

But if you wind back to *why* you want that -- apache already knows what
ip address the connection to it came from (which should be an address of
the server that nginx is running on).

It would have logged it, except that you configured apache to discard
that address and instead use the content of the X-Real-IP header.

Possibly changing the apache configuration to log the content of the
X-Real-IP header as well as its client ip address is easiest of all.

Whether that is appropriate in your environment depends on what else
your apache does with the information.

f
--
Francis Daly francis@daoine.org

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

set arbitrary http header?

zacharyalexstern February 01, 2013 02:21PM

Re: set arbitrary http header?

Francis Daly February 01, 2013 02:38PM

Re: set arbitrary http header?

zacharyalexstern February 01, 2013 02:44PM

Re: set arbitrary http header?

Francis Daly February 01, 2013 02:54PM

Re: set arbitrary http header?

zacharyalexstern February 01, 2013 02:57PM

Re: set arbitrary http header?

Francis Daly February 01, 2013 03:42PM

Re: set arbitrary http header?

zacharyalexstern February 01, 2013 03:47PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 173
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