Can't get Synchrony to start with Confluence & Apache SSL
Asked by Joe Mallon:

I've got Confluence 6.15.4 on CentOS 7 with Apache 2.4.39 as a front end so I can serve Confluence via SSL. Synchrony will not start properly, so collaborative editing doesn't work.

Confluence server.xml connectors (8091 added to get Synchrony port working):

```
<Connector port="8091" connectionTimeout="20000"
maxThreads="48" minSpareThreads="10"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
protocol="org.apache.coyote.http11.Http11NioProtocol"/>

<Connector port="8090" connectionTimeout="20000" redirectPort="443" proxyPort="443"
maxThreads="150" minSpareThreads="25" proxyName="confluence.wrs.com"
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8" scheme="https"
protocol="org.apache.coyote.http11.Http11NioProtocol"/>
```

Apache configuration:

```
<VirtualHost *:443>
ServerName ala-confluence-prod.wrs.com
ServerAlias ala-confluence-prod
ServerAlias confluence.wrs.com
ServerAlias confluence

ProxyRequests Off
ProxyVia Off

<Proxy *>
Require all granted
</Proxy>

ProxyPass /synchrony http://localhost:8091/synchrony
<Location /synchrony>
Require all granted
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule .* ws://localhost:8091%{REQUEST_URI} [P]
</Location>

ProxyPass / http://localhost:8090/
ProxyPassReverse / http://localhost:8090/

SSLEngine On
SSLCertificateFile /etc/httpd/conf.d/2019/cert.pem
SSLCertificateChainFile /etc/httpd/conf.d/2019/chain.pem
SSLCertificateKeyFile /etc/httpd/conf.d/2019/key.pem
</VirtualHost>
<VirtualHost *:80>
ServerName ala-confluence-prod.wrs.com
ServerAlias ala-confluence-prod
ServerAlias confluence.wrs.com
ServerAlias confluence

ProxyPass /synchrony http://localhost:8091/synchrony
<Location /synchrony>
Require all granted
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} Upgrade$ [NC]
RewriteRule .* ws://localhost:8091%{REQUEST_URI} [P]
</Location>

Redirect Permanent / https://ala-confluence-prod.wrs.com/
</VirtualHost>
<VirtualHost *:8090>
ServerName ala-confluence-prod.wrs.com
ServerAlias ala-confluence-prod
ServerAlias confluence.wrs.com
ServerAlias confluence

Redirect Permanent / https://ala-confluence-prod.wrs.com/
</VirtualHost>
```

Error if no 8091 connector in server.xml:

```
atlassian-confluence.log:2019-06-06 22:46:38,945 INFO
[http-nio-8090-exec-9][plugins.synchrony.config.
DefaultSynchronyConfigurationManager] retrievePublicKey [Collab editing
plugin] Could not retrieve public key for real-time collaboration service
at http://localhost:8091/synchrony/jwt-key with exception: Connect to 
localhost:8091 [localhost/127.0.0.1] failed: Connection refused
(Connection refused)
```

Error if I add a 8091 connector in server.xml:

```
atlassian-confluence.log:2019-06-06 22:55:13,965 INFO
[ThreadPoolAsyncTaskExecutor::Thread 31] 
[plugins.synchrony.bootstrap.DefaultSynchronyProxyMonitor] <init>
synchrony-proxy healthcheck url:
http://127.0.0.1:8091/synchrony-proxy/healthcheck

atlassian-confluence.log:2019-06-06 22:55:19,592 WARN [Catalina-utility-1] 
[impl.util.tomcat.DefaultTomcatConfigHelper] getHttpConnector Expected
exactly one HTTP connector in Tomcat configuration, but found 
[Standalone:type=Connector,port=8090, Standalone:type=Connector,port=8091]

atlassian-confluence.log:2019-06-06 22:55:20,368 WARN [Catalina-utility-1] 
[impl.util.tomcat.DefaultTomcatConfigHelper] getHttpConnector Expected
exactly one HTTP connector in Tomcat configuration, but found 
[Standalone:type=Connector,port=8090, Standalone:type=Connector,port=8091]

atlassian-confluence.log:2019-06-06 22:55:33,088 WARN 
[StartEventPublisher:thread-1] [impl.util.tomcat.DefaultTomcatConfigHelper] 
getHttpConnector Expected exactly one HTTP connector in Tomcat
configuration, but found [Standalone:type=Connector,port=8090, 
Standalone:type=Connector,port=8091]

atlassian-confluence.log:2019-06-06 22:56:14,929 INFO
[http-nio-8090-exec-20] [plugins.synchrony.config.
DefaultSynchronyConfigurationManager] retrievePublicKey [Collab editing
plugin] Could not retrieve public key for real-time collaboration 
service at http://localhost:8091/synchrony/jwt-key. Status code: 404
```

Can anyone help me solve this issue?


Answers:
author: Edwin Kyalangalilwa
body: Hi [@Joe Mallon](/t5/user/viewprofilepage/user-id/597484) ,

Synchrony should start by itself, no additional connector for 8091 should be configured.

Please confirm that you have enabled **mod_proxy_wstunnel** in Apache to allow websockets.

comments: author: Joe Mallon
body: That module is enabled and loaded, according to the output of apachectl.


author: Joe Mallon
body: There is also a mention in the docs about the Synchrony health check needing an HTTP connector. I'm not sure how to supply that, when I'm running via HTTPS.


Tags: confluence-server

server