Re: X-Forwarded-For
pangj <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
Thanks for all the answers. 于 2012-10-15 7:39, Cees Hek 写道: > On Mon, Oct 15, 2012 at 8:25 AM, Perrin Harkins <[email protected] > <mailto:[email protected]>> wrote: > > On Sat, Oct 13, 2012 at 7:41 AM, pangj <[email protected] > <mailto:[email protected]>> wrote: > > In nginx's config file we have added the x-forwarded-for header. > > With modperl (MP2) how to get this header? > > Use headers_in(): > http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_headers_in_ > > > As an alternative, you could use something like mod_rpaf on your backend > apache server: > > http://stderr.net/apache/rpaf/ > > This will look for an X-Forwarded-For header and if it is from a trusted > proxy server (ie a server specified in your config), it will update the > remote client information that apache sees. Makes ip addresses in your > access log much more useful, and means you don't need custom code to > look at proxy headers to figure out the real client ip address. > > Cheers, > > Cees Hek