Configure Tomcat to Find Proxy Headers

Last modified by Eleni Cojocariu on 2026/08/13 09:53

Content

Steps

Warning

WIP

To make Tomcat read the client IP address and protocol forwarded by an Nginx or Apache HTTP Server reverse proxy:

  1. Open the TOMCAT_HOME/conf/server.xml file.
  2. Locate the following <Engine> element:
    <Engine name="Catalina" defaultHost="localhost">
  3. 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>
  4. Save the file.
  5. Restart Tomcat to apply the changes.
  6. 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.

Get Connected