Krist van Besien wrote:
On 5/7/06, Ron Arts <[EMAIL PROTECTED]> 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


--
[EMAIL PROTECTED]
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: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
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: [EMAIL PROTECTED]
  "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to