nginx and Confluence - Base URL and page creation issue
Asked by Jack Kleiss:

I have set up nginx and Confluence on Ubuntu 16.04 according to the guide from Atlassian, and it works. However, setting my Base URL to the proxied address (e.g., helpdesk.example.com or helpdesk.example.com:8090) doesn't allow me to save new pages.

I can browse the entirety of my Confluence sites with no issues, but when I go to save a new page, it claims a server disconnection or under the extended create dialog just spins forever without populating the options. I can successfully edit and save already created pages. If I go directly to helpdesk.example.com:8090, everything works as expected (I can create, save, etc).

What do I need to change in order to never need to go to helpdesk.example.com:8090?

\*Note, I don't use the /confluence path in my settings, as I want my users to be able to directly go to just the flat <http://helpdesk.example.com> without needing to go to <http://helpdesk.example.com/confluence>

My nginx entry is like so:

```
server {
??? listen helpdesk.example.com:80;
??? server_name helpdesk.example.com;
??? location / {
??????? proxy_set_header X-Forwarded-Host $host;
??????? proxy_set_header X-Forwarded-Server $host;
??????? proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
??????? proxy_pass http://localhost:8090/;
??? }
}
```

and my server.xml is like this:

```
<Server port="8000" shutdown="SHUTDOWN" debug="0">
```

```
??? <Service name="Tomcat-Standalone">
```

```
??????? <Connector port="8090" connectionTimeout="20000" redirectPort="8443"
```

```
??????????????? maxThreads="48" minSpareThreads="10"
```

```
??????????????? enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"
```

```
??????????????? protocol="org.apache.coyote.http11.Http11NioProtocol" />
```

```
?
```

```
??????? <Engine name="Standalone" defaultHost="localhost" debug="0">
```

```
?
```

```
??????????? <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="false">
```

```
?
```

```
??????????????? <Context path="" docBase="../confluence" debug="0" reloadable="false" useHttpOnly="true">
```

```
??????????????????? <!-- Logger is deprecated in Tomcat 5.5. Logging configuration for Confluence is specified in confluence/WEB-INF/classes/log4j.properties -->
```

```
??????????????????? <Manager pathname="" />
```

```
??????????????????? <Valve className="org.apache.catalina.valves.StuckThreadDetectionValve" threshold="60" />
```

```
??????????????? </Context>
```

```
??????????? </Host>
```

```
?
```

```
??????? </Engine>
```

Any pointers would be appreciated!

<br />

<br />


Answers:
author: Steven F Behnke
body: The first thing I see is that you're missing the proxyName and proxyPort attributes from your connector element. You need to add the proper detail to Tomcat's configuration, which again is your server.xml connector element.

<https://tomcat.apache.org/tomcat-5.5-doc/config/http.html>
> **Set the URL for redirection**
>
> Next, set the URL for redirection. In the same \<CONFLUENCE-INSTALL\>/`conf/server.xml` file, locate this code segment:
>
> ```
> &lt;Connector port="8090" connectionTimeout="20000" redirectPort="8443"           maxThreads="48" minSpareThreads="10"           enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"           protocol="org.apache.coyote.http11.Http11NioProtocol"/&gt;
> ```
>
> And append the last line:
>
> ```
> &lt;Connector port="8090" connectionTimeout="20000" redirectPort="8443"           maxThreads="48" minSpareThreads="10"           enableLookups="false" acceptCount="10" debug="0" URIEncoding="UTF-8"           protocol="org.apache.coyote.http11.Http11NioProtocol"           proxyName="www.example.com" proxyPort="80"/&gt;
> ```

comments: author: Jack Kleiss
body: That was exactly what was wrong. I didn't see anything about those two parameters in Atlassian's KB articles on nginx. Thank you so much, everything is working properly now.


author: Steven F Behnke
body: Cool! :smile: No problem, good luck!


Tags: confluence-administration