You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tim Bishop <ti...@activespace.com> on 2000/07/11 18:56:07 UTC

using a 3-tier mod_perl setup

I am running a 3-tier mod_perl setup as advised by the Guide:  

     Lightweight apache <-> mod_perl apache <-> db server.  

One of the problems with this setup is that the mod_perl apache no longer
knows some details about the client request, like the client IP.  

I used Ask Bjoern Hansen's module proxy_add_forward, which adds a
"X-Forwarded-For" header to to the request as it is forwarded to the
mod_perl apache server.

After I added SSL to my lightweight (but gaining!) apache, I found
I needed some SSL connection information on the mod_perl server as well.

I recently fell in love with mod_rewrite, and so I ported some of its
capabilities to mod_headers

The attached patch
  (cd apache_1.3.XX; patch -p1 < ProxyHeaderRewrite.patch; make install)
will add two commands to mod_headers:

   HeaderRewrite       - dynamically set headers for the client
   ProxyHeaderRewrite  - dynamically set headers for the upstream proxy server

While the original mod_headers would allow you so say:

Header append Foo "burfl"

Now you can say

HeaderRewrite append Foo "%{ENV:BURFL}", using the full RewriteCond syntax



My current lightweight apache server config looks something like:

ProxyHeaderRewrite append X-Forwarded-For      "%{REMOTE_ADDR}" 
ProxyHeaderRewrite append X-Frontend-Host      "%{HTTP_HOST}"
<VirtualHost _default_:443>
   ...
   SSLOptions StdEnvVars
   ProxyHeaderRewrite append X-SSL-Cipher "%{ENV:SSL_PROTOCOL} %{ENV:SSL_CIPHER}"
</VirtualHost>


Did I miss another way to do this?  Is this patch useful?


BTW,

the Guide on server architecture:
http://perl.apache.org/guide/strategy.html

Ask Bjoern Hansen's module proxy_add_forward
http://www.cpan.org/authors/id/ABH/mod_proxy_add_forward.c


-Tim