comparison doc/src/site/markdown/server-setup.md @ 1698:7e4396e467de

Add documentation about running Tomcat behind a proxy.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Tue, 18 Dec 2018 11:35:41 +0100
parents 6d5e04a54848
children 79b95ce5d315
comparison
equal deleted inserted replaced
1697:fc8e4f893db1 1698:7e4396e467de
69 LogLevel warn 69 LogLevel warn
70 CustomLog ${APACHE_LOG_DIR}/digilib-ssl-access.log combined 70 CustomLog ${APACHE_LOG_DIR}/digilib-ssl-access.log combined
71 71
72 # do not forward-proxy! 72 # do not forward-proxy!
73 ProxyRequests off 73 ProxyRequests off
74 # set proxy proto header 74 # set proxy headers
75 ProxyPreserveHost On
75 RequestHeader set X-Forwarded-Proto "https" 76 RequestHeader set X-Forwarded-Proto "https"
76 # digilib instances 77 # digilib instances
77 <Proxy balancer://digilibs> 78 <Proxy balancer://digilibs>
78 BalancerMember http://127.0.0.1:8080 79 BalancerMember http://127.0.0.1:8080
79 BalancerMember http://otherserver.example.com:8080 80 BalancerMember http://otherserver.example.com:8080
94 95
95 When you are using [Jetty](https://www.eclipse.org/jetty/) as servlet container behind an Apache or nginx proxy 96 When you are using [Jetty](https://www.eclipse.org/jetty/) as servlet container behind an Apache or nginx proxy
96 then you should make sure that Jetty processes the `X-Forwarded-*` headers from the proxy server to derive the 97 then you should make sure that Jetty processes the `X-Forwarded-*` headers from the proxy server to derive the
97 correct request URL for the servlets. 98 correct request URL for the servlets.
98 99
99 Please see [this information for Jetty 9.4](http://www.eclipse.org/jetty/documentation/9.4.x/configuring-connectors.html#_proxy_load_balancer_connection_configuration) or [this information for Jetty 8 and earlier versions](https://wiki.eclipse.org/Jetty/Tutorial/Apache#Configuring_mod_proxy_http). 100 Please see [this information for Jetty 9.4](http://www.eclipse.org/jetty/documentation/9.4.x/configuring-connectors.html#_proxy_load_balancer_connection_configuration)
101 or [this information for Jetty 8 and earlier versions](https://wiki.eclipse.org/Jetty/Tutorial/Apache#Configuring_mod_proxy_http).
102
103 ## Tomcat behind a proxy
104
105 When you are using [Tomcat](https://tomcat.apache.org) as a servlet container behind an Apache or nginx proxy then
106 you should make sure that Tomcat processes the `X-Forwarded-*` headers from the proxy server to derive the
107 correct request URL for the servlets.
108
109 Please see the Tomcat documentation about the [Remote IP Valve](https://tomcat.apache.org/tomcat-9.0-doc/config/valve.html#Remote_IP_Valve).
110 You basically need to add the following XML tag with your proxy's IP numbers to the `Host` tag of your `server.xml` file:
111 ```
112 <Valve className="org.apache.catalina.valves.RemoteIpValve"
113 internalProxies="127\.0\.0\.1|123\.45\.67\.89"
114 remoteIpHeader="x-forwarded-for"
115 proxiesHeader="x-forwarded-by"
116 protocolHeader="x-forwarded-proto" />
117 ```
118 and make sure `ProxyPreserveHost` is set to `on`.