How to update or change outgoing links from issues and Dashboards in Jira Server and Data Center
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
This article was formerly titled "How to change the base URL in Jira", but renamed on Aug 12 2022 to fit a broader scope of any outgoing link.
Summary
When changing Jira's base URL (something common when migrating environments) or refreshing a test environment with Production data, several places in Jira may contain links to URLs that we should change, too.
Not updating these links may result in users being redirected to the old Jira URL or being redirected back to Production Jira or other Production Apps while browsing Jira in the test environment.
Please note this article is constantly under improvement and may not address all possible scenarios yet.
Also note 3rd party apps may, too, contain links that should be updated but it's beyond the scope of this article to address all of them. You should reach out to each app vendor if you notice wrong links in them and on how to update them.
Environment
Any version of Jira from 7.x onwards.
The DML commands on this article were written for the Postgres DB. You may need to tweak them to work on your specific DB.
Solution
The steps ahead presume Load Balancers, internal DNS and reverse proxies have already been configured for the new URL — as well as Jira Tomcat's server.xml under Jira's installation folder.
You may run the commands below for Jira's own URL if it's changed or to update other Apps' URLs (like from a Production Jira Align URL to the Test's URL).
1) Update Jira's base URL
When Jira's started on the new server and responding to the new URL, it'll pop up an alert when logging as Admin about the base URL not being set correctly.
You can either follow the link on the very alert popup or follow this guide on configuring the base URL. Just update it with the new URL and it's done.
- Configuring the Base URL
- You may come across situations where you're unable to edit the Base URL through the UI. For those cases, please review this article to change it directly on the database:
2) Recreate (all) Applications Links
Before the whole migration, it's prudent to access Jira's Application Links and take note of their configuration (which apps are connected and how: OAuth, OAuth with impersonation, etc).
After the migration is completed and Jira's accessible through the new URL, you may recreate the application links.
This should work two-way with Confluence and other Atlassian apps, so you shouldn't need to go through similar steps on all other Atlassian apps.
3) Change URL references in Gadgets and Issue
Text gadgets, issue descriptions, and issue comments can have text that mentions the previous Jira URL.
They should also be updated to prevent errors or misguidances when Jira is used.
Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.
Execute the following commands on Jira's DB to update these records:
update gadgetuserpreference set userprefvalue = REPLACE(userprefvalue, 'old-url.com', 'new-url.com') where userprefvalue like '%old-url.com%';
update remotelink set url = replace(url,'old-url.com','new-url.com') where url like '%old-url.com%';
update remotelink set iconurl = replace(iconurl,'old-url.com','new-url.com') where iconurl like '%old-url.com%';
update jiraissue set description = REPLACE(description, 'old-url.com', 'new-url.com') where description like '%old-url.com%';
update jiraaction set actionbody = REPLACE(actionbody, 'old-url.com', 'new-url.com') where actiontype = 'comment' and actionbody like '%old-url.com%';
update customfieldvalue set stringvalue = REPLACE(stringvalue, 'old-url.com', 'new-url.com') where stringvalue like '%old-url.com%';
update customfieldvalue set textvalue = REPLACE(textvalue, 'old-url.com', 'new-url.com') where textvalue like '%old-url.com%';
update "AO_550953_SHORTCUT" set "SHORTCUT_URL" = REPLACE("SHORTCUT_URL", 'old-url.com', 'new-url.com') where "SHORTCUT_URL" like '%old-url.com%';
In all of them, replace 'old-url.com' and 'new-url.com' accordingly.
Query Syntax
Please note that we've validated these queries with PostgreSQL. If you are using a different database system, you might need to review the query syntax and change it accordingly.