Installing with Apache proxy + SSL with context path + subdomain

Jason Rider October 26, 2015

Apache 2.4.7, mod_proxy, SSL.  JIRA7 + Confluence 5.8.14 on same server, installing to their own respective subdomains.

TL:DR:  Could not access JIRA/Confluence on a subdomain if I used a context path for JIRA or Confluence.  https://jira.domain.com --> http://internalserver:8080/jira and https://conf.domain.com --> http://internalserver:8090/confluence proxy did not work.  Had to take out and not use a context path to get the proxy to work  https://jira.domain.com --> http://internalserver:8080/ and https://conf.domain.com --> http://internalserver:8090/ respectively

 

I was using the guides here:
https://confluence.atlassian.com/doc/using-apache-with-mod_proxy-173669.html
https://confluence.atlassian.com/jira061/jira-installation-and-upgrade-guide/customizing-your-jira-installation/integrating-jira-with-a-web-server/integrating-jira-with-apache/integrating-jira-with-apache-using-ssl

 I was able to get everything running.  But initially, I installed the respective software to use a context path, https://internalserver:8080/jira  and https://internalserver:8090/confluence .  Problem is, whenever I tried that, I could not get the Proxy to work.

General Idea of the code:

// tomcat's server.xml
<Context path="/confluence" docBase="../confluence" debug="0" reloadable="true">
<Connector port="8090"
              ...
              proxyName="conf.domain.com" proxyPort="443" scheme=https" />
 
<Context docBase="${catalina.home}/atlassian-jira" path="/jira" reloadable="false" useHttpOnly="true">
<Connector port="8080"
              ...
              proxyName="jira.domain.com" proxyPort="443" scheme=https" />
 
// JIRA apache VHost
SSLProxyEngine          On
ProxyRequests           Off
ProxyPreserveHost       On
ProxyPass               /       http://localhost:8080/jira
ProxyPassReverse        /       http://localhost:8080/jira
ProxyHTMLURLMap / /jira/
 
// Confluence apache VHost
SSLProxyEngine          On
ProxyRequests           Off
ProxyPreserveHost       On
ProxyPass 			/ http://localhost:8090/confluence
ProxyPassReverse 	/ http://localhost:8090/confluence
ProxyHTMLURLMap / /confluence/

 A blank page would come up.  

I could visit http://localhost:8080/jira or http://localhost:8090/confluence just fine, but for some reason, the proxy would not work.  I tried modifying the settings in the virtualhost, but would get varying results.

Sometimes I could get the page to come through, but the CSS/JS would not load.  Or I would get a directory listing of the JIRA directory.  Or it would redirect to https://jira.domain.com/jira .  or 404.  

In order for it to work, I had to remove the context path completely

// tomcat's server.xml
<Context path="" docBase="../confluence" debug="0" reloadable="true">
<Connector port="8090"
              ...
              proxyName="conf.domain.com" proxyPort="443" scheme=https" />


<Context docBase="${catalina.home}/atlassian-jira" path="" reloadable="false" useHttpOnly="true">
<Connector port="8080"
              ...
              proxyName="jira.domain.com" proxyPort="443" scheme=https" />
 
// JIRA apache VHost
SSLProxyEngine          On
ProxyRequests           Off
ProxyPreserveHost       On
ProxyPass               /       http://localhost:8080/
ProxyPassReverse        /       http://localhost:8080/
ProxyHTMLURLMap / /jira/
 
// Confluence apache VHost
SSLProxyEngine          On
ProxyRequests           Off
ProxyPreserveHost       On
ProxyPass 			/ http://localhost:8090/
ProxyPassReverse 	/ http://localhost:8090/
ProxyHTMLURLMap / /confluence/

And then everything worked.

While it seems that from the guide for JIRA installation (2nd link), that if you wanted it on a subdomain, that you shouldn't use context path, the guide for Confluence (the first guide link) specifically states to use the /confluence context path and gives code to implement it as such.  

I guess not a big deal since I got it working, but I am a little confused as to why I couldn't get it to work using a context path for either JIRA or Confluence.  based on apache docs (https://httpd.apache.org/docs/2.4/mod/mod_proxy.html#proxypass ProxyPass [path] url), it should still work with a context path ?  

What am I missing?  

1 answer

0 votes
Alexander Penev [ByteSource] November 5, 2015
What happens if you try the following:

 

ProxyPass               /       http://localhost:8080/jira/
ProxyPassReverse        /       http://localhost:8080/jira/
?
Jason Rider November 9, 2015

Hello Alexander, Sorry for the late response. I modifed JIRA's server.xml, added "/jira" to the context path, and changed apache conf for jira to above. The result of going to the domain (https://jira.domain.com) redirects to https://jira.domain.com/jira/secure/Dashboard.jspa No CSS or JS is loaded An CSS/JS it tries to load is: https://jira.domain.com/jira/s/{LONG_HASH}/_/download/contextbatch/css/_super/batch.css (this very CSS can be loaded if I take out the /jira/ from the URL, as such: https://jira.domain.com/s/{LONG_HASH}/_/download/contextbatch/css/_super/batch.css The same could be said for JS Here is a screenshot of the page: http://i.imgur.com/0dA9JM6.png

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events