httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Arts <ron.a...@neonova.nl>
Subject Re: [users@httpd] reverse proxying to dynamically determined hosts
Date Sun, 07 May 2006 13:39:47 GMT
Krist van Besien wrote:
> On 5/7/06, Ron Arts <ron.arts@neonova.nl> wrote:
>> Hi,
>>
>> I am trying to accomplish the following:
>>
>> translate
>>
>>    http://<myhost>/device/<anotherhost>/pathinfo
>>
>> to a reverse proxy request to
>>
>>    http://<anotherhost>/pathinfo
>>
>> ProxyPass and ProxyReversePass are no good obviously,
>> so I am experimenting with mod_rewrite. But this:
>>
>> <Directory /usr/local/prod/web/html>
>>    RewriteEngine on
>>    RewriteRule ^dev/([0-9.]*)/(.*)  http://$1/$2 [P]
>> </Directory>
>>
>>
>> does not work. In fact I can't even get
>>
>> RewriteRule ^dev/192.168.170.212/(.*)  http://192.168.170.212/$1 [P]
>>
>> to work, because it redirects instead of proxies...
>> How would redirects from the remote host be handled in this case?
> 
> You have a [P] at the end. So it is supposed to proxy, and not to
> redirect. If your server however does redirect than there might be
> something else in your config doing that.
> 
> Have you tried running with a rewrite log?
> 

Krist,

thanks for the tip. I did that and it showed that the proxying worked,
but the remote server threw me a redirect, and my browser followed that
and ended up bypassing the reverse proxy!

So now I do it like this:

ProxyPassReverse /dev/ http://

<Directory /usr/local/prod/web/html>
   RewriteEngine on
   RewriteRule ^dev/([0-9.]*)/(.*)  http://$1/$2 [P]
</Directory>

And amazingly enough this totally works!

Boy do I love the Apache developers ;-)


Thanks,
Ron

> Krist
> 
> 
> -- 
> krist.vanbesien@gmail.com
> Solothurn, Switzerland
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message