proxy_add_forward_module

proxy_add_forward_module

Post by Deb » Wed, 09 Apr 2003 23:37:52



Hello there,

I am trying to proxy from port 80 to port 90. Port 80 does static pages
and port 90 is running mod_perl. This is all working fine except that...

The originating IP is not passed through to port 90.

I have loaded the proxy_add_forward_module but it didn't make any
difference, I have done a search on google and everyone says to use this

module but they don't say HOW. Am I supposed to do anything in the
config files besides uncomment this line and mod_proxy? How do I refer
to the originating host IP in my Perl code? I tried $ENV{$HTTP_HOST} and

got the IP of the port 80 proxy.

If I am on my desktop, and issue a request to the proxy, I need the
backend to know the IP of my desktop.

My log format is "%h %l %u %t \"%r\" %>s %b". The %h always shows the IP
of the proxy instead of the originating IP.

It would make my whole week and possibly my whole month to figure this
out ;-)

TIA,
Deb

 
 
 

proxy_add_forward_module

Post by Joshua Sli » Thu, 10 Apr 2003 04:08:19



> Hello there,

> I am trying to proxy from port 80 to port 90. Port 80 does static pages
> and port 90 is running mod_perl. This is all working fine except that...

> The originating IP is not passed through to port 90.

> I have loaded the proxy_add_forward_module but it didn't make any
> difference, I have done a search on google and everyone says to use this

> module but they don't say HOW. Am I supposed to do anything in the
> config files besides uncomment this line and mod_proxy? How do I refer
> to the originating host IP in my Perl code? I tried $ENV{$HTTP_HOST} and

Look in the request header X-Forwarded-For (env variable X_FORWARDED_FOR).
You can log this variable using %{X-Forwarded-For}i in your log format.

Joshua.

 
 
 

1. mod_proxy / proxy_add_forward_module and mod_rewrite: strange behavior !

Hello everyone,

I am using mod_proxy and proxy_add_forward_module to add the original IP
of the client. The configuration is a little bit complexe. I have 2
differents apache running, the 80 one which is as small as possible, the
second one which has the PHP module.

The front one deserve all the files it can handles (everything except
.php3) as the second one handles the PHP. My config file for the front
apache looks like:

<Files ~ "\.php3?$">
    RewriteEngine on
    RewriteBase /
    RewriteCond   %{THE_REQUEST} "^[^ ]+ ([^ ]+)"
    RewriteRule ^(.*)$ http://localhost:8080%1 [proxy]
</Files>

So all the .php3 files are redirected through the proxy. But the
X_FORWARDED_FOR var isn't completed.

If I use the following line:

ProxyPass / http://localhost:8080/

then it works perfect. So I guess this is a problem in mod_rewrite and
the [proxy] type. Does anyone know how to fix that ?

Thanks.

2. Check whether chars other than those in specified range are in a string