Log the original IP address when Stash is behind a load balancer
If Stash is behind a load balancer, you may see the load balancer's IP address in the
atlassian-stash-access.log instead of the IP address of the client making the request.
- The load balancer should send a header with the IP address of the original request, some load balancers use
- Add a Valve element to your
<Stash installation directory>/conf/server.xmlthat is configured for the header that the load balancer is sending
<Engine name="Catalina" defaultHost="localhost"> <Valve className="org.apache.catalina.valves.RemoteIpValve" internalProxies="127\.0\.0\.1" remoteIpHeader="x-forwarded-for" remoteIpProxiesHeader="x-forwarded-by" protocolHeader="x-forwarded-proto" />
- Read more about the RemoteIpValve here: https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/valves/RemoteIpValve.html