Tomcat: getHeader(“Host”) vs. getServerName()

后端 未结 4 432
南方客
南方客 2020-12-16 01:06

I\'ve got a Tomcat app that is being served up from multiple domains. Previous developers built a method to return the application URL (see below). In the method they reques

4条回答
  •  借酒劲吻你
    2020-12-16 02:04

    You need to ensure that httpd passes the Host header provided by the client to Tomcat. The easiest way (assuming you are using mod_proxy_http - you didn't say) is with the following:

    ProxyPreserveHost On
    

提交回复
热议问题