Apache SSL reverse proxy for JIRA forwarding to port 80 instead of 443

Andy Shinn April 6, 2016

I have followed https://confluence.atlassian.com/jira/integrating-jira-with-apache-using-ssl-203395380.html and am having trouble with a port redirection problem. When visiting https://jira.mydomain.com/ it is redirecting to port 80 (https://jira.natera.com:80/) which is unexpected and does not work.

If I navigate directly to the dashboard login URL (https://jira.natera.com/secure/Dashboard.jspa) it does load with "We've detected a potential problem" warning. The warning details are:

Dashboard Diagnostics: Mismatched URL Port
JIRA is reporting that it is running on the port '80', which does not match the hostname used to run these diagnostics, '443'. This is known to cause JIRA to construct URLs using the incorrect port, which will result in errors in the dashboard, among other issues.
The most common cause of this is the use of a reverse-proxy HTTP server (often Apache or IIS) in front of the application server running JIRA. While this configuration is supported, some additional setup might be necessary in order to ensure that JIRA detects the correct port.

Here is the server.xml (larger comments removed):

<?xml version="1.0" encoding="utf-8"?>
<Server port="8006" shutdown="SHUTDOWN">
    <!--APR library loader. Documentation at /docs/apr.html -->
    <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>
    <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html -->
    <Listener className="org.apache.catalina.core.JasperListener"/>
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
    <Service name="Catalina">
        <Connector port="8081"
                   maxThreads="150"
                   minSpareThreads="25"
                   connectionTimeout="20000"
                   enableLookups="false"
                   maxHttpHeaderSize="8192"
                   protocol="HTTP/1.1"
                   useBodyEncodingForURI="true"
                   redirectPort="8443"
                   acceptCount="100"
                   disableUploadTimeout="true"/>
	<!-- For SSL proxy -->
	<Connector port="8086"
                   maxThreads="150"
                   minSpareThreads="25"
                   connectionTimeout="20000"
                   enableLookups="false"
                   maxHttpHeaderSize="8192"
                   protocol="HTTP/1.1"
                   useBodyEncodingForURI="true"
                   redirectPort="8443"
                   acceptCount="100"
                   scheme="https"
                   proxyName="jira.mydomain.com"
                   proxyport="443"
                   secure="true"
                   disableUploadTimeout="true"/>
        <!--
              <Connector port="8009" redirectPort="8443" enableLookups="false" protocol="AJP/1.3" URIEncoding="UTF-8"/>
        -->
        <Engine name="Catalina" defaultHost="localhost">
            <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
                <Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false" useHttpOnly="true">
                    <Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"
                              factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
                    <Manager pathname=""/>
                </Context>
            </Host>
            <Valve className="org.apache.catalina.valves.AccessLogValve" resolveHosts="false"
                   pattern="%a %{jira.request.id}r %{jira.request.username}r %t "%m %U%q %H" %s %b %D "%{Referer}i" "%{User-Agent}i" "%{jira.request.assession.id}r""/>
        </Engine>
    </Service>
</Server>

And the Apache vhost:

<VirtualHost _default_:443>
	ServerName jira.mydomain.com
	ServerAdmin engineering@mydomain.com
	SSLEngine on
	SSLCertificateFile /etc/ssl/private/mydomain.com.wildcard.crt
	SSLCertificateKeyFile /etc/ssl/private/mydomain.com.wildcard.key
	SSLCertificateChainFile /etc/ssl/private/chain.pem
        SSLProxyEngine          On
        ProxyRequests           Off
        ProxyPreserveHost       On
	ProxyPass / http://ubuntuvm01.mydomain.local:8086/
	ProxyPassReverse / http://ubuntuvm01.mydomain.local:8086/
</VirtualHost>

 

The warning indeed seems correct in the reason. But I am unsure where I went wrong. Any ideas why this happens?

1 answer

1 vote
Andy Shinn April 6, 2016

The solution is very silly. There is an error with proxyport. It is supposed to be proxyPort (uppercase P). After that change to server.xml, it is working properly!

Suggest an answer

Log in or Sign up to answer