Configure Tomcat to Find Proxy Headers
Last modified by Eleni Cojocariu on 2026/08/13 09:53
Content
Steps
To make Tomcat read the client IP address and protocol forwarded by an Nginx or Apache HTTP Server reverse proxy:
- Open the TOMCAT_HOME/conf/server.xml file.
- 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.