Jira and a Reverse proxy

You might have a similar issue: when you want to install Jira, the default port for web servers (80) is already occupied.  Therefore you have to install Jira under a less common port. Due to company restrictions this port might be blocked due to safety reasons.

Solution: setup a reverse proxy. In this example we have Jira running on <example ip>:9004 which we want to make available through http://atlassian.<example>.com/jira

First step is to configure the base url in Jira (“Administration” -> “General Configuration”) to the value of “http://atlassian.<example>.com/jira”

Second step is to configure the apache server [httpd.conf]

LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so

ProxyPass /jira http://<example ip>:9004/jira
ProxyPassReverse /jira http://<example ip>:9004/jira

Step 3 is to restart the apache server

Now you will see that most functionality of Jira is already available through “http://atlassian.<example>.com/jira”. For example gadgets will not work yet because of the REST interface. Now the following error will be given

com.atlassian.gadgets.dashboard.internal.diagnostics.UrlHostnameMismatchException: Detected URL hostname, '<example ip>', does not match expected hostname, 'atlassian.<example>.nl'
	at com.atlassian.gadgets.dashboard.internal.diagnostics.Diagnostics.checkExpectedHostname(Diagnostics.java:71)
	at com.atlassian.gadgets.dashboard.internal.diagnostics.Diagnostics.check(Diagnostics.java:32)
	at com.atlassian.gadgets.dashboard.internal.diagnostics.DiagnosticsServlet.executeDiagnostics(DiagnosticsServlet.java:93)
	at com.atlassian.gadgets.dashboard.internal.diagnostics.DiagnosticsServlet.doPost(DiagnosticsServlet.java:61)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at com.atlassian.plugin.servlet.DelegatingPluginServlet.service(DelegatingPluginServlet.java:42)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at com.atlassian.plugin.servlet.ServletModuleContainerServlet.service(ServletModuleContainerServlet.java:52)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

To fix this, one additional step needs to be performed.

Step 4 is to change <jira installation directory>\conf\server.xml in which to add the proxyName and proxyPort attribute

<Connector port="9004" proxyName="atlassian.gjdb.nl" proxyPort="80"

and set the path to the value of “jira”

<Context path="/jira" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">

Step 5 – the final one – is to restart Jira