Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA Redirect to FQDN

Mike
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 5, 2019

I am running JIRA server 7.13.0 and trying to get a redirect to work from the server shortname to the FQDN without a proxy if possible

Right now users can go to:

https://jira or https://jira.FQDN.com 

I want everyone on the FQDN so things work as they should with the base url.

I was reading about: https://confluence.atlassian.com/fishkb/how-do-i-redirect-http-requests-to-https-without-proxy-707724570.html

When playing in my lab environment I was not having much success using the urlrewrite. Has anyone had luck this way? Or are people using something like apache?

 

For confluence (running windows.. for now), I ended up using IIS and do not want to go that route. 

1 answer

1 accepted

2 votes
Answer accepted
Daniel Eads
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 9, 2019

Hey Mike,

I definitely get wanting to shy away from IIS. Apache and especially nginx aren't that bad though! They both run on Windows so you could go that route if you wanted before switching over to a Linux server.

After playing around with this a little in a test environment, I was able to get this working with Jira in Tomcat. All that was required was adding a rule to urlrewrite.xml which for Jira is located at:

<jira-install>/atlassian-jira/WEB-INF/urlrewrite.xml

Below the existing <rule></rule> section in the file, I added the following rule (make sure to update the FDQN to the proper value):

<rule>
<condition type="scheme" operator="equal">https</condition>
<condition name="host" operator="equal">jira</condition>
<from>^/(.*)</from>
<to type="permanent-redirect" last="true">https://jira.FQDN.com/$1</to>
</rule>

Don't forget to restart Jira after making changes in this file to have them go into effect. And also - make sure you do this on a test environment first!

 

As mentioned in the documentation you linked to, doing this kind of change in your install directory won't persist across Jira upgrades. It's generally better to do this behind a reverse proxy so that it persists upgrades and is easier to troubleshoot. Pretty easy for this change to get lost in the Jira install path, whereas it's pretty simple to see an nginx config. Some food for thought as you move forward.

Cheers,
Daniel

Mike
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 9, 2019

Thanks Daniel - This leads me on the right track. Looks like I am getting ERR_TOO_MANY_REDIRECTS now but it is redirecting. Maybe something in my iptable rules is causing it

Edit: I put it on the default port and removed all iptable rules but still getting the too many redirects. Will continue troubleshooting. Thanks

Mike
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 18, 2019
tokcum
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 11, 2021

Thanks to your answers I figured out a way to redirect all names not matching the defined base URL.

<rule>
<condition type="scheme" operator="equal">https</condition>
<condition name="host" operator="notequal">jira.my-domain.local</condition>
<from>^/(.*)</from>
<to type="permanent-redirect" last="true">https://jira.my-domain.local/$1</to>
</rule>

This approach also avoids the ERR_TO_MANY_REDIRECTS.

In my server.xml short names coming via HTTP connector are redirected to HTTPS connector first. So this rule applies also to requests which used HTTP initially.

Like Daniel Eads likes this
Paul Stahlke
Contributor
March 25, 2022

I found that you also have to include the query string in the <to> line in order to capture all possible Jira links such as boards and filters, so like this:

<rule>
<condition type="scheme" operator="equal">https</condition>
<condition name="host" operator="notequal">jira.my-domain.local</condition>
<from>^/(.*)$</from>
<to type="permanent-redirect" last="true">https://jira.my-domain.local/$1?%{query-string}</to>
</rule>

Suggest an answer

Log in or Sign up to answer