0
我有這個問題,我的apache轉發http請求到tomcat使用代理(請參閱我的apache虛擬主機配置下面)。它工作正常,但網絡http請求http://subdomain.example.com/xyz/images/background2.jpg抵達tomcat as /xyz/xyz/images/background2.jpg。上下文名稱「xyz」會出現兩次,這會導致tomcat結尾處缺少資源。如何防止apache代理設置中的tomcat7重複上下文名稱
你如何解決這個問題?
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/...
我的項目放在Tomcat中作爲../ tomcat7/webapps/xyz/....我的意圖是將subdomain.example.com url映射到tomcat project url http://www.example.com :8080/xyz /,因此上面的設置。我不想將我的項目重命名爲ROOT,因爲我知道它不是由tomcat推薦的。 – Shawn 2014-09-03 15:00:33