Custom context path for internal Synchrony proxy
Asked by Matteo Lanati:

Hi,

I'm running Confluence 6.0.7 behind an Apache 2.4 configured to work as a SSL Proxy. I changed the context path to "/current" (in server.xml) so that I access my instance as https://\<my URL\>/current. So far so good, no problems encountered.  
I would like to use Synchrony by means of the internal proxy (so that I don't have to open an extra port) and, at the same time, change its context path as well. In particular, in the documentation \[1\] I read that "If Synchrony can't be reached via /synchrony-proxy we'll automatically try /confluence/synchrony-proxy (where /confluence is your Confluence context path)." I would expect Synchrony to be reachable as https://\<my URL\>/current/synchrony-proxy, while in the log file I see something like "Synchrony External Service URL: https://\<my URL\>/synchrony-proxy/v1"  
I tried to edit the file \<Confluence installation\>/conf/Standalone/localhost/synchrony-proxy.xml and modify the "Context path", but nothing changed. I also tried the system property "synchrony.context.path", though I don't think it's relevant in my case.

In conclusion, my questions are:  
- how can I customise the context path of the Synchrony proxy  
- once the previous step is successful, how the Apache Proxy rule should be modified (I suppose that "ProxyPass /synchrony-proxy http://localhost:8090/synchrony-proxy" won't do the trick anymore).

The reason why I need to customise the context path of both Confluence and Synchrony Proxy is that this is a test system, where there are different versions of Confluence running in parallel. Of course each of them has its own Tomcat container and database.

Thanks in advance for the help.

Matteo

PS: if I configure Confluence without context path and I enable the internal proxy (all behind the SSL proxy), I don't see any issue, everything works as expected.

\[1\] <https://confluence.atlassian.com/confeap/administering-collaborative-editing-847355676.html>


Answers:
author: AnnWorley
body: You may pass the **synchrony.context.path** propertyto Confluence. Please see [Recognized System Properties](https://confluence.atlassian.com/display/conf60/Recognized+System+Properties).


author: Matteo Lanati
body: Hi Ann,

Thanks for the suggestion, but this parameter changed only the context of Synchrony's internal URL, from

Synchrony Internal Service URL: <http://127.0.0.1:9096/synchrony/v1>  
to  
Synchrony Internal Service URL: <http://127.0.0.1:9096/current/synchrony/v1>  
My goal is to change the external URL. It is always

Synchrony External Base URL: https://\<my URL\>/synchrony-proxy

No matter what I change. Can someone confirm if it's hardcoded / not configurable?

Thanks,

Matteo

comments: author: AnnWorley
body: Matteo, I see now in your original posting that you already changed the Synchrony context path, and it wasn't helpful.

I checked with a Confluence support engineer and was told that indeed the synchrony-proxy path cannot be changed. However, you should be able to set up multiple virtual hosts in Apache, the examples given were:

ProxyPass /synchrony-proxy http://localhost:8090/synchrony-proxy  
for Confluence 1  
and:  
ProxyPass /synchrony-proxy http://localhost:8093/synchrony-proxy  
for Confluence 2

I look forward to hearing whether this is a workable configuration for your environment.


author: David THERY
body: Hi, have you some news about this case?  
i manage Two confluence instances in the same domain with contextpath and upgrade to 6.x are conditionned by this problem.  
Confluence manage context path properly and not synchrony, i don't understand why.

Please could you help us?


author: David THERY
body: In the end, I was able to validate a configuration with 2 confluences instances version 6.13 on the same domain and different context path.

it is enough to set the synchro path in the setenv

Example for Confluence2 accessible through the url https://mydomain/confluence2

Put that in setenv :  
CATALINA_OPTS="-Dsynchrony.context.path=/synchrony2 ${CATALINA_OPTS}"

And in your Apache virtualhost config:

ProxyPass /synchrony2 http://my-internal-host:47091/synchrony2  
ProxyPassReverse /synchrony2 http://my-internal-host:47091/synchrony2  
\<Location /synchrony2\>  
Require all granted  
RewriteEngine on  
RewriteCond %{HTTP:UPGRADE} \^WebSocket$ \[NC\]  
RewriteCond %{HTTP:CONNECTION} Upgrade$ \[NC\]  
RewriteRule .\* ws://my-internal-host:47091%{REQUEST_URI} \[P\]  
\</Location\>

ProxyPass /confluence2 http://my-internal-host:47090/confluence2  
ProxyPassReverse /confluence2 http://my-internal-host:47090/confluence2  
\<Location /confluence2\>  
Require all granted  
\</Location\>

Enjoy.

David


author: Matteo Lanati
body: Hi Lars,

many thanks for the answer. I also changed the port in setenv.sh in order to have a Synchrony instance for each Confluence. My goal is however to use the internal proxy because I don't want to expose the Synchrony port. In order to achieve it, I think I need to customise the path of Synchrony and/or the Synchrony proxy.

All the best,

Matteo


author: Lars Olav Velle
body: We are also running multiple confluence instances on the same server. Instead of changing the context path, we found it much easier to change the synchrony port:

In the start script of the application add someting like thins:

export JAVA_OPTS="$JAVA_OPTS -Dsynchrony.port=8092"


Tags: apache

ssl