Haroon Rafique wrote:
Hi Stas,

On Yesterday at 9:14pm, SB=>Stas Bekman <[EMAIL PROTECTED]> wrote:

SB> SB> but in apache2 it's built-in and no more requires a mod_perl module SB> for that. I don't have any examples but mod_proxy/mod_headers already SB> provide this functionality from what I've remember seeing on the SB> httpd-dev list.

Maybe I'm misunderstanding here, but I did mention (didn't I?) that mod_proxy already adds the X-Forwarded-For header from the front-end server (automatically). So that's not the issue here.

My apologies if I've missed that.

SB> SB> Actually, I've just found this example with google (requires SB> mod_headers):
SB> SB> RequestHeader set X-Forwarded-For %{REMOTE_ADDR}
SB> SB> Does it do the trick?
SB>


Not really. Unless I'm misunderstanding here again, your recipe above is doing what mod_proxy already does automatically on the front-end server. The back-end server is a whole different issue.

The issue at stake is really the back-end server which ends up seeing nothing but 127.0.0.1 in the access_log. By using My::ProxyRemoteAddr, I was able to extract the last IP in the X-Forwarded-For header chain and use that last IP address for the $r->connection->remote_ip($ip) call. This way the "back-end" server would see the real IP server even in the access_log and in all the perl scripts as well without any other finagling.

so the X-Forwarded-For header is there at the back-end, but Apache won't use it to set remote_ip, right? So I'm trying to figure out whether Apache provides some internal mechanism for doing that. But I can't find any Apache2 API that does that.


To be really explicit, I have 2 requirements:

1) back-end server should log the client's IP address in the server logs.

2) All the mod_perl scripts on the back-end server should be able to see the client's IP address without taking any extra steps.

So yes, you have a solid case, Haroon. I'll re-enable back that field. Thank you.



-- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com

--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html



Reply via email to