Confluence 6.15.3 on different machine with http port than front end nginx https
Asked by EdisonCh:

Dear All,

My newly installed confluence 6.15.3 is running on different machine behind the front end nginx https server that is facing the Internet. Everything runs but confluence always complaining that the base url is not the same.

I actually made it look almost the same except the port.

My users access it from public internet by typing <https://confluence.mydomain.com>.

The https requests would be capture by my front end nginx running https then proxy pass it to back end server on the different machine with the same name <http://confluence.mydomain.com:9777> different only in the port instead of port 80 I do the port 9777 (tomcat connector). Confluence keeps bugging me about this.

Internal network recognizes confluence.mydomain.com is at backend machine instead of front end because I put the name (confluence.mydomain.com) in /etc/hosts in both front end and back end machines.

How do I keep the confluence happy with the setting without having tomcat to run on port 80 on the backend machine ?

So It does not keep bugging me with this complain:

**Your URL doesn't match**

Confluence's base URL is set to [http://confluence.mydomain.com:9777](http://confluence.scandiumsc.com:9777/) but you are accessing Confluence from [https://confluence.mydomain.com](https://confluence.scandiumsc.com/).

[Update base URL](https://confluence.scandiumsc.com/admin/editgeneralconfig.action)


Answers:
author: Nic Brough -Adaptavist-
body: You don't. Confluence runs on one url, the base url.

You can make it listen on others, as it's something Tomcat allows, and you can get partial functionality when using them, but you really need to access it over the base url only.

The only way to "solve" this problem is to stop connecting via any url that is not the base url.

comments: author: EdisonCh
body: The short answer is No and I must make confluence run on port that I designated.

Thus I make it runs on port 80 on Ubuntu using authbind (to enable port lower than 1024 to run by non-root user) - <http://confluence.mydomain.com> in my backend server where confluence resides. To access it however, I use <https://confluence.mydomain.com> \<-- again confluence complain that base url must be the same - even though I can still access and do things in it.

To make thing short, I try to run it in https as well in my backend server where confluence lives.

Then I get error 502 Bad Gateway error.

I check the error log for catalina.out and here what I get: (any suggestion?)

05-May-2019 13:17:49.953 INFO \[Catalina-utility-2\] org.springframework.web.servlet.DispatcherServlet.initServletBean FrameworkServlet 'dispatcher': initialization completed in 1156 ms  
05-May-2019 13:19:16.279 INFO \[main\] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler \["http-nio-80"\]  
05-May-2019 13:19:16.311 INFO \[main\] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler \["http-nio-443"\]  
05-May-2019 13:19:16.331 INFO \[main\] org.apache.catalina.startup.Catalina.start Server startup in \[89,108\] milliseconds  
05-May-2019 13:19:16.383 INFO \[http-nio-443-exec-1\] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header  
Note: further occurrences of HTTP request parsing errors will be logged at DEBUG level.  
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens  
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:414)  
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:294)  
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)  
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)  
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)  
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)  
at java.lang.Thread.run(Thread.java:748)

05-May-2019 13:19:16.903 INFO \[http-nio-80-exec-1\] com.sun.jersey.server.impl.application.WebApplicationImpl._initiate Initiating Jersey application, version 'Jersey: 1.19.4 05/24/2017 03:20 PM'

----

Here is my server.xml

\<Connector port="80" connectionTimeout="20000" redirectPort="8443"  
maxThreads="48" minSpareThreads="10"  
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"  
protocol="org.apache.coyote.http11.Http11NioProtocol"  
scheme="http" proxyName="confluence.mydomain.com" proxyPort="80"/\>

\<Connector port="443" connectionTimeout="20000" redirectPort="8443"  
maxThreads="48" minSpareThreads="10"  
enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"  
protocol="org.apache.coyote.http11.Http11NioProtocol"  
scheme="https" secure="true" proxyName="confluence.mydomain.com" proxyPort="443"/\>

\<Engine name="Standalone" defaultHost="localhost" debug="0"\>  
\<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false" startStopThreads="4"\>  
\<Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true"\>  
\<Manager pathname=""/\>  
\<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60"/\>  
\</Context\>

\<Context path="${confluence.context.path}/synchrony-proxy" docBase="../synchrony-proxy" debug="0"  
reloadable="false" useHttpOnly="true"\>  
\<Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60"/\>  
\</Context\>  
\</Host\>  
\</Engine\>


author: EdisonCh
body: Dear All,

I am starting to run out of options regarding the base URL thing. Confluence's application lives at back-end server. Front-End server runs nginx and accepts everything in https mode - I have to proxy pass it to back-end server.

Since its requirement url must be the same, I am out of idea on how to do this.

My users accesses using <https://confluence.mydomain.com> - I proxy pass it to <http://confluence.mydomain.com> (notice the http and https different between front-end and back-end) - the confluence still complains about base url must be the same.

I tried to ignore it - but then some of icons would not show up and the Create Space's feature would not run at all (it keeps spinning around without end).

Could anyone help me out here?

The stack consists of Confluence version 6.15.3, Ubuntu 18.04 and nginx.


Tags: confluence-server

server