JIRA redirect to reverse proxy does not redirect to login page or dashboard under https

Niklas Jung June 21, 2019

Hey folks:)

Jira was setup without a contextpath on a linux server running plesk under a subdomain. SSL Cert in plesk was setup and working. Domain https://sub.domain.com is working but a 404 error appears and down i need to klick on "homepage" as it does not redirect to the login url / screen or the l "secure/dashboard" page. When opening http://sub.domain.com:8080 the redirect works directly. The reverse proxy was setup with htaccess file in vhost directory of the subdomain (JIRA install folders etc. are standard).

htaccess content:

RewriteEngine on
RewriteRule ^(.*)$ http://sub.domain.com:8080%{REQUEST_URI} [P,L]

This works perfect once logged in etc. 

In the connector the connector was set to https:

<Connector port="8080" relaxedPathChars="[]|" relaxedQueryChars="[]|{}^&#x5c;&#x60;&quot;&lt;&gt;"
maxThreads="150" minSpareThreads="25" connectionTimeout="20000" enableLookups="false"
maxHttpHeaderSize="8192" protocol="HTTP/1.1" useBodyEncodingForURI="true" redirectPort="8443"
acceptCount="100" disableUploadTimeout="true" bindOnInit="false" secure="true" scheme="https"
proxyName="sub.domain.com" proxyPort="443"/>

 

No idea what else to do to get the redirect working with the 8080 port but not under the https link. Also to clarify https link and redirect for JIRA works perfectly. Further the question is there a way to disable access by 8080 / redirect to 80 which then redirects to 443 and the https link?

 

Thanks

1 answer

1 accepted

0 votes
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 24, 2019

Hi Niklas,

I see that you are looking to redirect the traffic via a proxy that is sent to Jira so that your end users can utilize a specific URL for Jira while still getting everything to work in Jira. 

I have to admit that I'm not well versed in the use of Plesk, but I am curious if you happened to see our guide on Integrating Jira with Apache using SSL.   I realize that this might not apply 100% to your exact environmental situation, but this is a helpful guide for using an Apache reverse proxy with SSL.   Many of the setup steps in this guide I can see would need to be applied via other proxy types too for Jira to work correctly.

For example, that guide does have a means to redirect all traffic sent over http to port 80 to instead use https and port 443.  You can see this in:

2.3 Redirect HTTP to HTTPS

This can be done with either of the following:

  • Set up the HTTP VirtualHost to forward to the same Tomcat Connector. Tomcat will redirect to HTTPS using the schemeproxyName & proxyPort parameters. This can be done as in our Integrating Jira with Apache documentation.
  • Using mod_rewrite (this module may require enabling), add the following to the HTTP VirtualHost:

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Try to see if you can follow that guide as a means to configure this in your environment.  I think this could be promising as this rewrite rule would encompass all the requests, but there are also other steps to make sure that both Jira and apache are configured correctly here.  It might be that you cannot make all the same changes in a plesk environment, I'm not sure how that environment will differ from the versions of Apache in that guide.

I hope this helps.

Andy

Niklas Jung June 25, 2019

Dear Andy thanks a lot!

Below the steps where missing in my setup:

In Plesk Webinterface you have the option under the domain you let jira run under --> settings for apache and ngix --> a field called "additional directives for https"

I filled in there:

<Proxy *>
Order deny,allow
Allow from all
</Proxy>

SSLProxyEngine On
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://sub.jira.com:8080/
ProxyPassReverse / http://sub.jira.com:8080/


where sub.jira.com would be replaced by your domain name. This field will be applied to the httpd.conf, which you can't edit in plesk at it is regenerated each time. The field mentioned above will result in a vhost_ssl.conf file which is technically included in the httpd.conf file in apache.

File location of httpd.conf and vhost_ssl.conf would be:

/var/www/vhosts/system/ <domain_name> /conf/

 

Also htaccess file needed to be changed in the www directory (webfolder) of the jira domain to:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

 

Now all works fine and if i do http://sub.jira.com it redirects me to https://sub.jira.com/secure/Dashboard.jspa

 

Thanks again

Like Andy Heinzer likes this

Suggest an answer

Log in or Sign up to answer