最近我不得不为使用 Tomcat6 的客户端安装 Java 应用程序。该应用程序需要从其域的根目录运行,因此我还安装了 apache2 和 mod_proxy_ajp 来设置代理以使其工作。经过一些按摩和谷歌搜索来处理位置标头,包括 servlet 的原始路径而不是代理根。我想出了这个。
<VirtualHost *:80>
ServerName myclientssite.com
ErrorLog /var/log/apache2/ajp.error.log
CustomLog /var/log/apache2/ajp.log combined
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
ProxyRequests Off
ProxyPass / ajp://localhost:8009/appname/
ProxyPassReverse / http://localhost:8080/appname/
ProxyPassReverseCookiePath /appname/ /
Header edit Location ^([^/]*//[^/]*)?/appname/(.*)$ $1/$2
</VirtualHost>
我的问题是枯萎这是最好的解决方案。似乎没有 mod_headers 和 Header 编辑行,并且 headers 通常包含 appname 子目录。