Log the original IP address when Bitbucket Server is behind a load balancer or reverse proxy

Still need help?

The Atlassian Community is here for you.

Ask the community


If Bitbucket Server is behind a load balancer or reverse proxy, you may see the load balancer's or reverse proxy's IP address in the atlassian-bitbucket-access.log instead of the IP address of the client making the request. 


For Bitbucket Server version 5 or later

In Bitbucket Server 5.0+ if the load balancer is sending over the x-forwarded-for header, this should be logged correctly in the access logs without any further configuration needed.

Whilst Bitbucket Server 5 will do this for you without additional configuration, if you need to customise these settings in Bitbucket Server 5, you can apply the following settings in $BITBUCKET_HOME/shared/bitbucket.properties:

For Bitbucket Server 4

In order for this to work, the load balancer should send a header with the IP address of the original request, some load balancers use x-forwarded-for

Add a Valve element to your $BITBUCKET_HOME/shared/server.xml that is configured for the header that the load balancer is sending

<Engine name="Catalina" defaultHost="localhost">
    <Valve className="org.apache.catalina.valves.RemoteIpValve" 
        protocolHeader="x-forwarded-proto" /> 

Last modified on Mar 27, 2019

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.