Forum Moderators: phranque

Message Too Old, No Replies

PreserveHostHeader when using RewriteRule

RewriteRule PreserveHostHeader

         

oldtimer1234

6:39 am on Jul 12, 2005 (gmt 0)

10+ Year Member



I am using Apache 2.0.52 as a reverse proxy.
This work fine using mod_proxy and since my backend webserver need the correct Request Hostname I use the
ProxyPreserveHost which works fine.

Now I had to some more complicated proxying (adding variable to query string etc) and then used the RewriteEngine with RewriteCond and RewriteRule directives but I am losing my PreserveHostHeader, how should do this using the RewriteRule?

I want my Apache reverse proxy to listen to www.test.com and do my rewrite stuff and send request to ip x.x.x.x by preserve my request host header, should it do this by default?

jdMorgan

3:08 pm on Jul 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is the host header being modified by the proxy rewrite discussed in your other thread [webmasterworld.com]?

If so, the general form


RewriteRule ^/test.asp(.*) http://[b]%{HTTP_HOST}[/b]:81/test.asp?userid=%{LA-U:REMOTE_USER} [QSA,P,L]

might help.

oldtimer1234

11:46 am on Jul 14, 2005 (gmt 0)

10+ Year Member



Sounds exactly like what I want, will test, and yes I am talking about the rewrite in the other thread.