Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to edit Confluence pages using HAProxy configuration

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. 

2 answers

1 accepted

1 vote
Answer accepted

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;
}

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.

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";
}

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. 

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

you should't use docker 

Your dumb reply doesn't help anyone.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

113 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you