How to create multiple URL redirects for JIRA and Confluence?
Asked by Tony Montana:

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


Answers:
author: Youssri
body: If like us have moved to cloud there is an app, [Redirection by Easy Apps](https://marketplace.atlassian.com/apps/1224699/redirection-by-easy-apps?hosting=cloud&tab=overview).


author: Benjamin Primrose
body: 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;  
}

<br />

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;  
}  
}


author: Nic Brough -Adaptavist-
body: 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.

comments: author: Tony Montana
body: 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


author: Nic Brough -Adaptavist-
body: 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.


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


author: David Willson
body: Can you elaborate on this more? What steps did you take to "

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


author: Nic Brough -Adaptavist-
body: Nothing was done, as there is nothing that can be done.


author: David Willson
body: Ok thanks.


author: Tony Montana
body: [@David Willson](/t5/user/viewprofilepage/user-id/1527163) look this [https://community.atlassian.com/t5/Jira-questions/Jira-behind-nginx-HTTPS-proxy-default-page/qaq-p/32107](https://community.atlassian.com/t5/Jira-questions/Jira-behind-nginx-HTTPS-proxy-default-page/qaq-p/32107 "How.")


author: David Willson
body: 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-](/t5/user/viewprofilepage/user-id/781454) 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.

<br />

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.

<br />

SO what is possible?

<br />

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-](/t5/user/viewprofilepage/user-id/781454) has been dutifully posting and re posting year after year.

<br />

Other last thoughts + ideas:

<br />

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](/t5/user/viewprofilepage/user-id/618001) 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


author: Tony Montana
body: [@David Willson](/t5/user/viewprofilepage/user-id/1527163) 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.


Tags: confluence-server

jira

jira-server

linux

server