On 7/18/2017 6:29 AM, Mark Thomas wrote:
Note: Passing on the host header can require explicit configuration. In
the proxy. e.g. for httpd:

ProxyPreserveHost On

The best tool that I found to set up reverse proxy is Tomcat's RemoteIpFilter --
https://tomcat.apache.org/tomcat-8.5-doc/api/org/apache/catalina/filters/RemoteIpFilter.html
which I configure like so in the web descriptor:

|<filter> <filter-name>RemoteIpFilter</filter-name> <filter-class>org.apache.catalina.filters.RemoteIpFilter</filter-class> <init-param> <param-name>internalProxies</param-name> <param-value>127\.0\.0\.1</param-value> </init-param> <init-param> <param-name>remoteIpHeader</param-name> <param-value>x-forwarded-for</param-value> </init-param> <init-param> <param-name>remoteIpProxiesHeader</param-name> <param-value>x-forwarded-by</param-value> </init-param> <init-param> <param-name>protocolHeader</param-name> <param-value>x-forwarded-proto</param-value> </init-param> </filter> <filter-mapping> <filter-name>RemoteIpFilter</filter-name> <url-pattern>/*</url-pattern> <dispatcher>REQUEST</dispatcher> </filter-mapping>|


Then in the web server I pass the following headers from the web server to Tomcat (example shows nginx as web server, but they all work the same, the only difference is the variable names in the web server):


|proxy_set_header Host $host; ## CGI.HTTP_HOST|


See https://gist.github.com/isapir/8a70ed85b3a7a6e92908191f938d7a1a for more.


Igal Sapir

Lucee Core Developer
Lucee.org <http://lucee.org/>

Reply via email to