【发布时间】:2014-09-03 18:19:25
【问题描述】:
我有这个问题,我的 apache 使用代理将 http 请求转发到 tomcat(请参阅下面的 apache 虚拟主机配置)。它工作正常,但 web http 请求 http://subdomain.example.com/xyz/images/background2.jpg 以 /xyz/xyz/images/ 的形式到达 tomcat背景2.jpg。上下文名称“xyz”出现两次,导致在 tomcat 结束时缺少资源。
你如何解决这个问题?
Apache 虚拟主机配置文件
<VirtualHost *:80>
ServerName subdomain.example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://www.example.com:8080/xyz/
ProxyPassReverse / http://www.example.com:8080/xyz/
</VirtualHost>
Tomcat 项目设置:../tomcat7/webapps/xyz/...
【问题讨论】: