apache reverse proxy: following redirects?

Is it possible to make apache (2.2) mod_proxy follow upstream redirects (http 301, 302)?

Usually one would configure a reverse proxy like:

ProxyPass /foo  http://upstream.example.com/bar
ProxyPassReverse /foo  http://upstream.example.com/bar

However, if upstream.example.com responds with a redirect, it is passed through for the client to follow.

Is it possible to make apache follow the redirect(s) until it gets a proper response and only then respond to the client?


I dont think it's possible. It will be a protocol violation at minimum in the 302 case. In both cases by the behaviour you're describing you're going to reply to a page that gives a redirection with a 200.

Not sure why you're trying to do this though. If you need this for performance better you cache the reply, which with apache is quite easy to do.