How to create multiple URL redirects for JIRA and Confluence?

Tony Montana
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.
March 19, 2019

Hello community!

How to create multiple URL redirects for JIRA and Confluence?

 

Task:

- We have a several DNS aliases (ex. project1.domain.com, project2.domain.com)

- Need redirect, ex. from project1.domain.com to jira.domain.com/project/TEST1

- Need redirect, ex, from project2.domain.com to jira.domain.com/project/TEST2

DNS server send alias for jira-server. how next? any ideas? 

Thank you for the Help!

Best Regards

3 answers

0 votes
Youssri March 19, 2024

If like us have moved to cloud there is an app, Redirection by Easy Apps.

0 votes
Benjamin Primrose June 6, 2022

Use NginX on the Atlassian server to issue permanent redirects based on the host name used to access the server.  You could use a similar approach using the project names instead of the app names as I did here.  Our Confluence has migrated to cloud.

 

http {
server {
listen 80;
server_name my-company-atlassian my-company-atlassian.mycompany.local;

location / {
proxy_pass http://my-company-atlassian.mycompany.local:8080/;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

location /confluence {
rewrite ^/confluence/?(.*)$ https://my-company.atlassian.net/wiki/$1 permanent;
}

location /wiki {
rewrite ^/wiki/?(.*)$ https://my-company.atlassian.net/wiki/$1 permanent;
}

location /jira {
rewrite ^/jira/?(.*)$ http://my-company-atlassian.mycompany.local:8080/$1 permanent;
}


location /bitbucket {
rewrite ^/bitbucket/?(.*)$ http://my-company-atlassian.mycompany.local:7990/$1 permanent;
}
}

server {
listen 80;
server_name bitbucket bitbucket.mycompany.local;

location / {
rewrite ^/(.*)$ http://my-company-atlassian.mycompany.local:7990/$1 permanent;
}
}

server {
listen 80;
server_name jira jira.mycompany.local;

location / {
rewrite ^/(.*)$ http://my-company-atlassian.mycompany.local:8080/$1 permanent;
}
}

server {
listen 80;
server_name confluence confluence.mycompany.local wiki wiki.mycompany.local;

location / {
rewrite ^/(.*)$ https://my-company.atlassian.net/wiki/$1 permanent;
}
}

0 votes
Nic Brough -Adaptavist-
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.
March 19, 2019

Redirects are something you do with DNS, by stub web-pages (a short piece of javascript on a static html page on project1.domain.com can redirect the user's browser straight to the right place), or by redirects inside the web-server.

But this is all redirects, and not something you do in Jira.  You'll need to tell us what software you have on the urls you want to redirect from, or what your DNS is, and hope we know them well enough to help.

Also, there's not a huge amount of use for this.  Once your users have been redirected, their browser will be on the Jira base url and continue to work from that.  Redirects are generally only useful when you've moved a system to a new url and people have bookmarks and old links that you want to direct over to the new one.

Tony Montana
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.
March 19, 2019

JIRA or Confluence based by Tomcat 9. 

On my DNS server I created rule alias project1.mydns.com. And this alias  connected to JIRA Server by IP.

 

Now. How to with JIRA tomcat use this alias for open  project jira.domain.com/project/TEST1

Like Boy Dep Trai likes this
Nic Brough -Adaptavist-
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.
March 19, 2019

It won't.  That's why I tried to explain what redirects are doing.

Jira uses and works on a single base url.  Everything is done relative to, or using that url.

You can easily redirect any url you want to land on Jira, or specific places in Jira, but people will then be using the system on the Jira base url once the redirection has got them to the end point.  There's no "alias" or using Jira on other urls.

Tony Montana
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.
March 19, 2019

But, I am install new ngins server on JIRA server. Disable tomcat and rule URI's  from this ngins server

David Willson
Contributor
December 11, 2019

Can you elaborate on this more? What steps did you take to "

Disable tomcat and rule URI's  from this ngins server"?

Nic Brough -Adaptavist-
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.
December 12, 2019

Nothing was done, as there is nothing that can be done.

David Willson
Contributor
December 12, 2019

Ok thanks.

Tony Montana
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.
December 19, 2019
David Willson
Contributor
January 6, 2020

TLDR;

Nic was right, you can only have one base url because the base url is used in internal application functions. External proxies only fix external requests. Atlassian software functionality is hard coded to use the base url and doesn't provide the option for multiple base urls. If your goal is to have a fully functional Jira you can only use one url.

---

I have been searching for a clear answer on this for a while now. @Nic Brough -Adaptavist- has answered many many times on this issue on so many posts but I always felt that the explanation still wasn't satisfying enough; I enjoy knowing exactly how things work and why things don't work. Our team is very technical and because most websites have no issues having multiple names, being told we can't have multiple names evokes ire, disbelief and frustration.

I finally found a post from Nic in this last round of searching that helped clarify specifically WHY the base url is important, and why multiples really isn't an option. I'm going to paraphrase it here and try to be as direct and clear and thorough as possible as to why.


1) You set the base url inside the software (it gets stored in the database).

2) The application code uses this hard coded base url to perform SOME application activities ie generate links to the service desk site in emails it sends sent out.

3) This internal generation is important, because when we say "we want multiple" URLS for a site, we are really talking external interaction with the site.

5) Setting up a proxy server, proxies the external requests to the site, but has nothing to do with the code that is generating pages and requests based on the internally defined base url. Proxies works find for incoming requests, but doesn't impact how the internal code operates.

SO short answer is "there can only be one" and have everything work as expected. Atlassian's design of the base url is effectively a HARD CODED string that is used by the application code to make parts of the software function, and you can't set more then one.


SO what is possible?


6) You CAN setup multiple URL's to a jira site, because like other websites, it's functionality is not ALL based on the base url. BUT stuff will break. What will break? Good question. I've posted this page to try and get to the bottom of this but havn't gotten any hits thus far. https://community.atlassian.com/t5/Jira-discussions/Base-URL-Deep-Dive-Jira-vs-Confluence-The-Multiple-URL-Question/td-p/1187810.

7) If you setup multiple URLS, the email sent in emails from jira will be based on the base url (as designed). If you only publish the URL you want (aka not the base url) that will leaving your customers frustrated and annoyed because they will get a link in an email to a domain that doesn't work.

8) This means that you COULD setup multiple URLs but the simple short and often repeated answer is "no you can't have multiple urls", which is to say "if you are expecting this product to work correctly and as expected you can only have one url" which is what @Nic Brough -Adaptavist- has been dutifully posting and re posting year after year.


Other last thoughts + ideas:


9) The reality is that my job is to find solutions and make things work. Sometimes that means testing and validating things and taking on acceptable risk/problems if it doesn't impact day to day operations. I've been thinking about this in context of both Jira and Confluence and I think there is a scenario where users need a narrow set of functionality, say Confluence, where you could create a second url, things will work fine for them because they only need to see pages or some other limited functionality. (Of note - you would also have to test and confirm it worked and Atlassian likely wouldn't support the config). You would see broken/unexpected things if you tried to do more then the limited set and you would have to be OK with getting errors as an admin, but if it works and was reliable then that would be fine.

10) All this is nice and well as long as using 2 urls doesn't cause data corruption or data loss. If that can happen then the answer is simple, no you can't have multiple urls there will be data loss or corruption in the following scenarios x y z.

11) It seems to me that the best way to have multiple URL's is to have multiple instances and then use plugins to synchronize the important data between them. That comes with additional cost, and work but if it gets the best solution to your issue then it may be worth it.

12) @Tony Montana thank you for posting and providing information and ideas but the answer referencing another page doesn't really clarify how you would solve this issue of internally dependent functions on the base url. I'm open to suggestions and ideas, and if you have others I'd be happy to hear them. I don't want to discourage creative thinking, and want to promote clear detailed solutions.

David

Like # people like this
Tony Montana
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.
January 7, 2020

@David Willson We have 1 server with JIRA Software and JIRA Service Desk. With support nginx and reverse proxy we have 2 3d level domains for SD and JIRA. Its working good. And with one plugin we're having simple urls for SD Customer Portals.

You just need to consult with your system administrators more. It is not strange that Atlassian Support people in companies knows less about network processes and technologies. But I connected Network Administrators to my work and we succeeded.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events