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

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptoms

If Bitbucket is behind a load balancer or the 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.

Resolution

In Bitbucket Data Center 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.

Bitbucket Data Center 5 and newer will do this for you without additional configuration for the "x-forwarded-for" header.

If you need to customize these settings in Bitbucket 5.x - 7.7, you can apply the following settings in $BITBUCKET_HOME/shared/bitbucket.properties:

1 2 3 server.tomcat.remote_ip_header=x-forwarded-for server.tomcat.protocol_header=x-forwarded-proto server.tomcat.internal_proxies=127\\.0\\.0\\.1

If you need to customize these settings in Bitbucket 7.8 and newer, you can apply the following settings in $BITBUCKET_HOME/shared/bitbucket.properties::

1 2 3 server.tomcat.remoteip.remote-ip-header=x-forwarded-for server.tomcat.remoteip.protocol-header=x-forwarded-proto server.tomcat.remoteip.internal-proxies=127\\.0\\.0\\.1

Please note that the values in the examples above are already configured by default. You need to adjust them only if you use different headers.

This guide is only applicable to HTTP(S). For SSH, please check the KB How to enable Client IP Forwarding For SSH Sessions by setting up Proxy protocol for Bitbucket Data Center.

Updated on April 16, 2025

Still need help?

The Atlassian Community is here for you.