Can you use Redirect and Proxypass at the same time
I am using Apache 2.2.15 on CentOS to provide SSL for a TomCat application.
ProxyPass / http://127.0.0.1:8090/ connectiontimeout=300 timeout=300
ProxyPassReverse / http://127.0.0.1:8090
This works fine and everything is great; however, I want to add the following line:
Redirect permanent /broken/page.html https://www.servername.com/correct/page.html
before the above to handle an error in the TomCat application itself. However, it does not appear to work the way I expect (i.e, it appears to do nothing and change nothing). Is it possible to use Redirect this way? I don't have the ability to edit the application, unfortunately.
Solution 1:
Yes! Above the ProxyPass /
, add:
ProxyPass /broken/page.html !
That'll force the proxypass to not act on the page that you're trying to redirect.
Solution 2:
<Proxy>
blocks are also useful as the context is always understood to be applying to proxied traffic. In this fashion you don't need to exclude specific paths.
<Proxy *>
Redirect permanent /broken/page.html https://www.example.com/correct/page.html
RedirectMatch ^/deadstuff.+ http://www.example.com/correct/page.html
</Proxy>
ProxyPass / http://127.0.0.1:8090/ connectiontimeout=300 timeout=300
ProxyPassReverse / http://127.0.0.1:8090