* JW <gav...@yahoo.com> wrote: > Date: Fri, 10 Mar 2017 03:53:27 +0000 > From: JW <gav...@yahoo.com> > To: "modperl@perl.apache.org" <modperl@perl.apache.org> > Subject: Re: Question about Apache 2.4 and libapreq2 (Apache2::Request) > > Hi, > Back in January I was planning on moving to Apache 2.4+mod_perl+libapreq2 > from Apache 2.2+mod_perl+libapreq2. I'd asked if anyone had problems doing a > similar > move -- the answer was no. Thank you again to everyone who replied my earlier > post. > > It's been over a month since moving to Apache 2.4. It was fairly > straightforward and requiredlittle code to be updated, most of it Apache > config. Everything runs as it did before the update and I've > had no problems. The one function that didn't 'work' is described below. > > This mod_perl server is behind a proxy on the same machine. Under Apache 2.2, > $r->remote_ip() > returned 127.0.0.1 and not the user's actual IP. So, a > PerlPostReadRequestHandler extracted the user's > IP address from the X-Forwarded-For header and set it with $r->remote_ip( $ip > ). > > In Apache 2.4 (and mod_perl now) $c->remote_ip is split into $r->useragent_ip > and $c->client_ip: > http://httpd.apache.org/docs/2.4/developer/new_api_2_4.html > But, $r->useragent_ip (wrongly) gives me 127.0.0.1. Perhaps this'll be fixed > at some point (unlessI'm doing something wrong). So, for now, as above, the > IP is extracted from X-Forwarded-For > and set with $r->useragent_ip( $ip ). You seem to be using an old version of mod_perl, for I remember I had to use "$r->useragent_addr->ip_get();" to get at the user's real address with the latest version of mod_perl.
Regards, Jie > I was asked by one of the earlier responders to share my experience with the > move to Apache 2.4,in case there were others in the same boat. So, if there > are, jump right in and good luck! > Cheers, > John > > > > > > > > > > > >