Configure Tomcat to Find Proxy Headers
Last modified by Eleni Cojocariu on 2026/05/20 16:51
Content
Steps
When using Nginx or Apache HTTP Server as a reverse proxy in front of Apache Tomcat / XWiki, Tomcat should be configured to correctly interpret forwarded proxy headers (such as the original client IP address and HTTPS protocol), if such headers are used in the reverse proxy configuration.
- Open the server.xml file in the Tomcat configuration directory. (Usually located in /tomcat_version/conf/server.xml).
- Locate the following <Engine> element:
<Engine name="Catalina" defaultHost="localhost"> - Add the following RemoteIpValve configuration directly inside the <Engine> element:
<Engine name="Catalina" defaultHost="localhost"> <Valve className="org.apache.catalina.valves.RemoteIpValve" internalProxies="127\.0\.[0-1]\.1" remoteIpHeader="x-forwarded-for" requestAttributesEnabled="true" protocolHeader="x-forwarded-proto" protocolHeaderHttpsValue="https" /> </Engine> - Save the file.
- Restart Tomcat to apply the changes.
- Verify the configuration by accessing your wiki through the proxy URL:
https://yourdomain.com/xwiki. Verify that:- HTTPS URLs are generated correctly.
- Redirects use HTTPS.
- The client IP address is correctly forwarded.
- Login sessions and WebSocket connections work properly.