我在CentOS上使用Apache 2.2.15为TomCat应用程序提供SSL。
ProxyPass / http://127.0.0.1:8090/ connectiontimeout=300 timeout=300 ProxyPassReverse / http://127.0.0.1:8090
这工作正常,一切都很好, 但是,我想添加以下行:
Redirect permanent /broken/page.html https://www.servername.com/correct/page.html
在上面处理TomCat应用程序本身的错误之前。 然而,它似乎没有按照我所期望的方式工作(即它看起来什么都不做,也没有改变)。 这样可以使用redirect吗? 我不能编辑应用程序,不幸的是。
是! 在ProxyPass /上方,添加:
ProxyPass /broken/page.html !
这将强制代理通行证不作用在您尝试redirect的页面上。
上下文总是被理解为适用于代理stream量,所以<Proxy>块也是有用的。 用这种方式,你不需要排除特定的path。
<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