You don't, but you can often make it work the way you need it anyway.
First off, make sure you need to use RewriteRule
instead of simply ProxyPass
. The rule you've provided is quite simple; if you don't have some RewriteCond
logic in front if it, then you can just as easily use ProxyPass
.
In any case, let's take an example where you're doing something like this:
RewriteRule ^/proxied-location/(.*)$ http://backend/$1 [P]
So, you're taking a request for http://your-apache-server/proxied-location/something.html
and sending it to the backend without the /proxied-location/
part of the URL.
A redirecting (30x
) response would not include the /proxied-location/
part of the URL, despite the fact that the client needs that in order to access the other resource through the proxy. That's what ProxyPassReverse
handles. So, just add a configuration like this:
ProxyPassReverse /proxied-location/ http://backend/
The config only applies on requests where the proxy backend handles the response, so the "conditions" that you've applied with mod_rewrite
effectively still apply.
Make sense?