How to use Apache as a Load Balancer for Confluence Data Center

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Atlassian applications can be accessed through Load Balancer, however, Atlassian Support does not provide assistance for configuring it. Consequently, Atlassian cannot guarantee providing any support for it.


This how-to guide aims to provide all the details you need to set up Apache as a Load Balancer for your Confluence Data Center instance. In this example, we will consider a two node Cluster with Synchrony in self-managed mode, although it should work fine for Synchrony standalone mode as well.

Tests for the steps below were performed with Confluence version 6.12.


In this section, we will cover how to configure your Apache server to act as a Load Balancer for your nodes.


  1. Apache version 2.4+ with support for support WebSockets
  2. The following modules must be enabled in your main httpd.conf file:
    1. proxy_module

    2. proxy_http_module

    3. proxy_wstunnel_module
    4. proxy_balancer_module
    5. lbmethod_byrequests_module
    6. headers_module
    7. rewrite_module

Virtual host settings

The configuration below enables support for WebSockets and forward requests directly to Synchrony, which should result in the lowest latency possible while interacting with the editor:

Apache Virtual Host
<VirtualHost *:80>

    # Specify your server name, should match the external domain of the instance
    ServerName <COMPANY-DOMAIN>

    <Location /balancer-manager>
        SetHandler balancer-manager
        Require all granted

    # Main Synchrony proxy rule
    ProxyPass /synchrony  balancer://synchrony-http/synchrony

    # Synchrony HTTP balancer declaration
    <Proxy balancer://synchrony-http>
        BalancerMember http://<Server1-IP>:<Synchrony-PORT> route=synnode1
        BalancerMember http://<Server2-IP>:<Synchrony-PORT> route=synnode2

        Require all granted

    # Synchrony WebSocket balancer declaration
    <Proxy balancer://synchrony-ws>
        BalancerMember ws://<Server1-IP>:<Synchrony-PORT> route=synnode1
        BalancerMember ws://<Server2-IP>:<Synchrony-PORT> route=synnode2

        Require all granted

    # WebSocket rewrite condition and rules
    RewriteEngine     On
    RewriteCond       %{REQUEST_URI}       ^/synchrony/(.*)/bayeux-sync1   [NC]
    RewriteRule       /(.*)                balancer://synchrony-ws/$1      [P,L]

    # Main Confluence balancer
    <Proxy "balancer://confluence-cluster">
        BalancerMember "http://<Server1-IP>:<Confluence-PORT>" route=1
        BalancerMember "http://<Server2-IP>:<Confluence-PORT>" route=2
        ProxySet stickysession=ROUTEID

    # Main Confluence proxy rules
    ProxyPass        "/" "balancer://confluence-cluster/"
    ProxyPassReverse "/" "balancer://confluence-cluster/"


You will notice that we have three balancers declared, they are:

  1. <Proxy balancer://synchrony-http>: Main Synchrony HTTP balancer, it will forward all non-WebSocket connections to the Synchrony nodes
  2. <Proxy balancer://synchrony-ws>: Second Synchrony balancer, this one is dedicated to forwarding the WebSocket connection that is established between the browser and Synchrony when we open the editor
  3. <Proxy "balancer://confluence-cluster">: This is the Confluence HTTP balancer, it will forward the requests that do not target Synchrony to the respective servers and endpoint

After creating the virtual host above, make sure to restart Apache so it can pick up the new settings.


If you are terminating SSL at Apache, which is recommended, you will just need to add the certificate related information to the configuration above and change the port of the Virtual Host to 443. Also, please make sure to swap the placeholders with the actual IPs and Ports used by Confluence and Synchrony.

Tomcat settings

In this section, we will cover the changes needed in <Confluence-Install>/conf/server.xml to add the Load Balancer settings. This is a connector example with the Proxy/LB settings in place:

<Connector port="<PORT>" connectionTimeout="20000" redirectPort="8443"
maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
scheme="<HTTP/HTTPS>" proxyName="<DOMAIN>" proxyPort="<ProxyPort>"/>

The place holders here are:

  1. port="<PORT>": this should be set to the port that the balancer is targeting for the Confluence requests, by default it is 8090
  2. scheme="<HTTP/HTTPS>": this should match the protocol that you are using to access the application
  3. proxyName="<DOMAIN>": should be set to the company domain, same as the proxy ServerName parameter and the server base URL set in the UI
  4. proxyPort="<ProxyPort>": set this to the port that Apache is listening to, usually 80 for HTTP and 443 for HTTPS

Make sure to apply those changes in all of your Confluence nodes and restart them to apply.


If you face issues while creating/editing pages (specifically, 404 HTTP responses), check: CONFSERVER-55946 - Getting issue details... STATUS

Additionally, confirm that you don't have this property set on your Apache configs: ProxyErrorOverride on.

If you do, remove it.

DescriptionConfigure Apache as Load Balancer for Confluence Data Center

Last modified on Jan 6, 2021

Was this helpful?

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