Atlassian Confluence Server for Windows is bundled with a web server which runs on port 8090. Most organisations would rather a more user-friendly URL such as confluence.domain.com. Although this isn’t technically supported by Atlassian, it’s best practice to leave this port as is and instead implement a Reverse Proxy.
The following steps assume you’re running Confluence Server on Windows Server 2012 R2 or higher over HTTPS.
<clear />
<rule name="HTTP to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" />
</rule>
<rule name="Synchrony HTTP" stopProcessing="true">
<match url="^synchrony/(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="http://localhost:8091/synchrony/{R:1}" />
</rule>
<rule name="Synchrony Web Sockets Reverse Proxy" stopProcessing="true">
<match url="ws://(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="ws://localhost:8091/{R:1}" />
</rule>
Add the following lines directly below </system.webServer>:
<system.web>
<httpRuntime executionTimeout="20" maxRequestLength="61440" requestPathInvalidCharacters="" requestValidationMode="2.0" />
<pages validateRequest="false" />
</system.web>
The final result should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="HTTP to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" />
</rule>
<rule name="Synchrony HTTP" stopProcessing="true">
<match url="^synchrony/(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="http://localhost:8091/synchrony/{R:1}" />
</rule>
<rule name="Synchrony Web Sockets Reverse Proxy" stopProcessing="true">
<match url="ws://(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="ws://localhost:8091/{R:1}" />
</rule>
<rule name="Confluence" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="http://localhost:8090/{R:1}" />
</rule>
</rules>
</rewrite>
<security>
<requestFiltering allowDoubleEscaping="true" />
</security>
<caching enabled="false" enableKernelCache="false" />
</system.webServer>
<system.web>
<!-- This keeps IIS from complaining about special characters in the url. Also has some controls for max upload size. Set to the equivalent of the above, but in kilobytes instead of bytes. (ex. 61440 = 60MB) -->
<httpRuntime executionTimeout="20" maxRequestLength="61440" requestPathInvalidCharacters="" requestValidationMode="2.0" />
<pages validateRequest="false" />
</system.web>
</configuration>
<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" />
Add the proxyName, proxyPort, and scheme attributes:
<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="confluence.domain.com" proxyPort="443" scheme="https" />
cd C:\Program Files\Atlassian\Confluence2\libtomcat9w //ES//<CONFLUENCE-SERVICE-N
-Dorg.apache.tomcat.websocket.DISABLE_BUILTIN_EXTENSIONS=true
iisreset /noforce
View Comments
Hi,
I followed your guide, but still i am unable to get it to work - it actually threw some errors, after i started the confluence service..
Something about server.xml had errors and proxyname, scheme and port was incorrect.
That sounds like a syntax error in the server.xml file. I recommend restoring a previous version and retry seeing the correct values.