httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel López Robles <>
Subject Re: [users@httpd] Reverse proxy with mod_rewrite using RewriteRule [P]
Date Wed, 03 Mar 2010 17:17:12 GMT
Tom Evans escribió:
> 2010/3/2 Daniel López Robles <>:
>> Hello:
>> We have two Apaches in a server:
>> Apache 2.2.14, reverse proxy, listening to IP 192.168.24.X
>> Apache 2.2.11, which actually serves the websites, listening to IP
>> 192.168.24.Y
>> Domain name points to our reverse proxy Apache, and we need
>> it to send requests to the other Apache in this way:
>> ->
>> Our rewrite rule:
>> RewriteRule ^/(.*) http://$ [L,P]
> This looks very wrong.
>> In RewriteLog we can see that the rewrite rule is working fine up to some
>> point:
>> ....
>> [][rid#eef078/initial] (2) rewrite '/something' ->
>> ''
>> ...
>> [][rid#ef3088/initial] (2) rewrite
>> '/public/index.aspx' -> 'http://public/'
> as these two lines point out.
> If you request the URL on the
> proxy, your rule says to rewrite this to http://foo/
> - does that LOOK right?!
> I would do this much more explicitly, rather than allow the users to
> specify the hosts that we will proxy to:
> ProxyPass /something/
> ProxyPassReverse /something/
> ProxyPassReverseCookieDomain
> and then repeat those lines for each host that you wish to be proxied.
> If you really can't do this, and must have it dynamic, then I suggest
> a regular expression tutorial :)
> Cheers
> Tom
Yes, you are right, Tom, if the user requests 
"http//" it will be rewritten 
to "http//something/public/" that is of course not 
correct. I know this is not the best RewriteRule directive. The question 
is that if http// is being properly rewritten 
as http//, and redirects 
to, why is being logged the 
attempt to rewrite "'/public/index.aspx' -> 
'http://public/'" in the reverse proxy Apache? It 
seems that the http// request is being sent to the 
reverse proxy Apache itself.

Actually, I have changed the RewriteRule directive for a more explicity one:

RewriteRule ^/something/(.*)$1 [L,P]

And some kind of infinite loop is being created. RewriteLog:

192.168.24.X - - [03/Mar/2010:17:23:50 +0100] 
[][rid#ef0130/initial] (2) init rewrite engine 
with requested uri /something/
192.168.24.X - - [03/Mar/2010:17:23:50 +0100] 
[][rid#ef0130/initial] (3) applying pattern 
'^/something/(.*)' to uri '/something/'
192.168.24.X - - [03/Mar/2010:17:23:50 +0100] 
[][rid#ef0130/initial] (2) rewrite 
'/something/' -> ''
192.168.24.X - - [03/Mar/2010:17:23:50 +0100] 
[][rid#ef0130/initial] (2) forcing 
proxy-throughput with
192.168.24.X - - [03/Mar/2010:17:23:50 +0100] 
[][rid#ef0130/initial] (1) go-ahead with proxy 
request proxy: [OK]
[...] Then, those 5 lines again and again.

But if I look the access log of the Apache that actually serves, I can see also a lot of request at the same time, so it 
looks like the request is being sent from the reverse proxy to the 
Apache 2.2.11 and back a lot of times.

192.168.24.Y - - [03/Mar/2010:17:23:52 +0100] "GET / HTTP/1.0" 302 191 
"-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; WOW64; SV1; .NET 
CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.4506.2152; .NET CLR 
[...] Again and again.

I don't get it, I must be missing something. Any clue, please?

Thank you very much.


Proteccin de Datos: ACOTELSA le informa de que los datos facilitados por Ud. y utilizados
para el envo de esta comunicacin sern objeto de tratamiento automatizado o no en nuestros
ficheros, con la finalidad de gestionar la agenda de contactos de nuestra empresa y para el
envo de comunicaciones profesionales por cualquier medio electrnico o no. Vd. podr en cualquier
momento ejercer el derecho de acceso, rectificacin, cancelacin y oposicin en los trminos
establecidos en la Ley Orgnica 15/1999. El responsable del tratamiento es ACOTELSA, con domicilio
en Ronda de Poniente, 3 bajo, 28760 Tres Cantos, Madrid.

Confidencialidad El contenido de esta comunicacin, as como el de toda la documentacin anexa,
es confidencial y va dirigido nicamente al destinatario del mismo. En el supuesto de que
usted no fuera el destinatario, le solicitamos que nos lo indique y no comunique su contenido
a terceros, procediendo a su destruccin. Gracias.

Confidenciality The content of this communication and any attached information is confidential
and exclusively for the use of the addressee. If you are not the addressee, we ask you to
notify to the sender and do not pass its content to another person, and please be sure you
destroy it. Thank you.

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