How can I use Apache to reverse proxy a dynamic url

Posted by backplane on Stack Overflow See other posts from Stack Overflow or by backplane
Published on 2010-05-22T05:51:07Z Indexed on 2010/05/22 6:00 UTC
Read the original article Hit count: 402

I want a user to be able to load a url in their browser, but not get redirected:

http://example.com/abc/{var1}/{var2}/def

I want the example.com apache 2.2 server to take that request, and "invisibly" and without redirect reverse proxy it to:

http://other.example.com/abc/{var1}/{var2}/def

I have spent hours trying different combinations of RewriteRule, ProxyPass, ProxyPassMatch, and ProxyPassReverse, all to no avail. Here is my current attempt, which seems to do a redirect to /test instead of an invisible proxy.

RewriteRule ^/abc/([^/\.]+)/([^/\.]+)/def/?$ /test/abc/$1/$2/def [P]
ProxyPass /test http://other.example.com/ 
ProxyPassReverse /test http://other.example.com/

© Stack Overflow or respective owner

Related posts about apache

Related posts about mod-rewrite