httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Folini <>
Subject Re: [users@httpd] Need help to deal with poorly written PHP apps behind Apache used as Reverse Proxy
Date Mon, 22 Oct 2007 06:30:41 GMT
On Fri, Oct 19, 2007 at 09:09:54PM +0200, Alan AZZERA wrote:
> > RewriteRule /(.*)  http://backend/$1 [proxy,last]
> But AFAIK, mod_rewrite cannot alter anything *inside* the HTML code
> going out the server. mod_proxy_html can...


> I'm currently trying to deal with PMWiki. It uses only HTTP_HOST. The
> problem with this application is that developpers use HTTP_HOST to
> construct absolute URL everywhere in the HTML code their PHP generate,
> even in CSS and Scripts. Pfouark !

Typical behaviour. 

Try to do it the following way with mod_proxy, mod_rewrite and

RewriteRule /(.*)  http://backend/$1 [proxy,last]

<Proxy ...>
   RequestHeader  set    Host    ""

This should trick your wiki to use to generate
the correct HTML code without the need to rewrite the response.

If you want to get your hands really dirty, you can also
leave mod_headers aside and set statically
in /etc/hosts to point to the backend. That way the proxy
server will still believe that he is via
servername, but when you proxy to it will
go to the backend via /etc/hosts with the right host-header
to let the backend generate the correct URLs. Not that I 
would recommend it, but I have seen this in practice...



The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message