Re: X-Forwarded-For

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Mohit Anchlia" <mohitanchlia@xxxxxxxxx> writes:

> Our traffic is going through proxy, how can I enable X-Forwarded-For
> in apache to get the original IP. Does this also work for users using
> ISP (private IP) and are behind the ISP router.

Do you mean you have Apache acting as a proxy and you want it to send
the X-Forwarded-For header, or you have another proxy server and you
want Apache to do something with the information in its
X-Forwarded-For header?

Apache should generally send this information properly on its own,
see:

    http://httpd.apache.org/docs/trunk/mod/mod_proxy.html

The easiest way to handle the headers in in the application side.
ISPs may use proxies, too, so if you only want special treatment for
requests from your own proxy, you should check the IP address of the
connection, and if it's your proxy use the information from the last
X-Forwarded-For header, which should always be the one it added (you
can also use the Via header).  For an example in PHP see:

    http://devcentral.f5.com/weblogs/macvittie/archive/2008/06/02/3323.aspx

That's how I've always done it, but there are some modules that claim
to do some of this work for you so you could avoid changing your Web
apps:

    http://www.cotds.org/mod_extract_forwarded2/
    http://search.cpan.org/~jvanasco/Apache2-xForwardedFor-0.04/lib/Apache2/xForwardedFor.pm

I haven't used either, and there may be others.

Good luck!

----Scott.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux