Unable to edit Confluence pages using HAProxy configuration

Celine Villafuerte October 10, 2018

Good day,

We are currently migrating our Confluence instance from IP to hostname; however, we are unable to edit pages due to this error:

error.png

 

We suspect that it has something to do with Synchrony and its configuration mapping with HAProxy. In our previous IP instance, we used nginx with this configuration:

location /confluence {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://confluence_web:8090;
}

location /synchrony {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://confluence_web:8091;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}

Everything works fine, but after migrating to HAProxy, even though Confluence is accessible using the DNS, we experienced editing issues as seen in the screenshot above. Our current haproxy.cfg configuration looks like this:

backend confluence_server
mode http
balance source
option forwardfor

server confluence 107.105.134.53:8090 check


backend synchrony_server
mode http
balance source
option forwardfor

server synchrony 107.105.134.53:8091 check

We are unsure if we converted the configurations properly. We already modified our server.xml located in confluence-server/confluence_install/conf which looks like this:

<Connector port="8090" 
     protocol="org.apache.coyote.http11.Http11NioProtocol"
     connectionTimeout="20000"
     URIEncoding="UTF-8" acceptCount="10"
enableLookups="false" debug="0" redirectPort="443" maxThreads="200" minSpareThreads="10" scheme="http" proxyName="mycompany.com" proxyPort="80" />

We deployed the Confluence service using docker-compose and already exposed both 8090 and 8091 ports in our config file.

Any help is appreciated. Thank you. 

3 answers

1 accepted

1 vote
Answer accepted
Dave Theodore [Coyote Creek Consulting]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 10, 2018

It looks like you're running on Server, so I'll assume you have Synchrony and Confluence running on the same server.  I'll also assume you are running a version later than 6.2. Earlier versions of Confluence 6 Collaborative Editing worked differently than modern versions, so if you are running 6.0 or 6.1, save yourself some hassle and upgrade to the latest version.

In your HAproxy config, you are setting a context for Confluence. This will make your URL look like:

http://confluence.domain.com/confluence/display/SPACE/Page+Name

You are also calling a context for Synchrony, which will make the Synchrony traffic go to: 

http://confluence.domain.com/synchrony/heartbeat

Since you have a Confluence Context, you need the Synchrony traffic to go to:

http://confluence.domain.com/confluence/synchrony/heartbeat

In modern versions of Confluence, you don't need to do anything special with Synchrony any more, as Tomcat proxies it. Furthermore, there really is no good reason to run a Confluence Context with HAproxy sitting ahead of Confluence. 

Try this setting and get rid of the Synchrony settings:

location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://confluence_web:8090;
}
Celine Villafuerte October 10, 2018

Thank you for your quick response. Unfortunately, we are using Confluence 6.0 and it worked fine with the synchrony path using nginx. But we need to migrate to a hotsname url which entails using HAProxy, but the config above does not work.

I also checked http://domain.com/synchrony/heartbeat, it returned "Ok", but we're still experiencing the same editing issues.

Dave Theodore [Coyote Creek Consulting]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 11, 2018

It should work if you remove the context from the HAproxy config.

location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://confluence_web:8090;
}

location /synchrony {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://confluence_web:8091;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
Celine Villafuerte October 15, 2018

Our domain name hosts several services so we need to have /confluence as its context. As of now, we temporarily set collaborative editing to limited since we are having problems with Synchrony. 

0 votes
Contegix Support December 12, 2022

@Dave Theodore [Coyote Creek Consulting] 

your comments have location stanzas for nginx, not haproxy.

We too need to know if this route can work w/o any proxy running locally on the confluence server:

Web --> Haproxy server --> Confluence server:8080

We do not run any proxy (apache, nginx, etc) on the confluence server.  And Synchrony is running under the confluence pid, not standalone.

We do have this in confluence.cfg.xml, and i'm wondering if it should be set to False because we're not proxying 8081 anywhere:

 <property name="synchrony.proxy.enabled">true</property>

 

thanks!

0 votes
bdegier August 3, 2020

I have the exact same problem with Confluence. It first worked fine through nginx but I had to re-route the traffic through our HaProxy loadbalancers and now we have two problems:

  • Very slow loading pages
  • Publishing/editing pages either fails or takes a long time. If it fails it can take up to 5 tries before it suddenly works again.

All other traffic routed through HaProxy works fine. It feels like the websocket connections aren't setup properly sometimes.

backend docs
balance roundrobin
mode http
option forwardfor
server docker-ams7-01 10.100.20.17:8092 check

Port 8092 is an external Docker port which goes to internal port 8090

Administrator October 9, 2020

you should't use docker 

bdegier October 10, 2020

Your dumb reply doesn't help anyone.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events