Categories
Atlassian

Jira &Confluence Server redirect to Cloud

Atlassian did discontinue their server licensing on February 15th, 2024. After a lengthy migration project, the course of action has been decided and tested. It is now time to migrate to the Atlassian Cloud. Unfortunately, as of yet, a custom domain setup is not possible, so we will have to redirect old links to the new domains at Atlassian.

Redirects for a BIG-IP F5 LoadBalancer

I decided to use a 302 redirect with a no-cache header because in my case, the redirection is only for usability and has no relevance for SEO. This allows me to improve or extend the iRule in case there is a need to cover more cases.

iRule for Jira

# Atlassian Cloud Migration Redirects Jira
# web-performance.ch 2024-01-13
when HTTP_REQUEST {
    if {[HTTP::has_responded]} {return}
    # Extract the URI of the incoming request
    set uri [HTTP::uri]

    # Check if the URI starts with /browse/
    if { [string tolower $uri] starts_with "/browse/" } {
        # Extract the issue key which is the part of the URI after "/browse/"
        set issuekey [string range $uri 8 end]

        # Perform a 302 redirection to the new URL with the issue key
        HTTP::respond 302 Location "https://yourtenant.atlassian.net/browse/${issuekey}" Cache-Control "no-cache"
        return
    } elseif { [string tolower $uri] starts_with "/secure/dashboard.jspa" } {
        # Perform a 302 redirection to the dashboard URL
        HTTP::respond 302 Location "https://yourtenant.atlassian.net/jira/dashboards" Cache-Control "no-cache"
        return
    } else {
        # Redirect all other requests to the main JIRA page
        HTTP::respond 302 Location "https://yourtenant.atlassian.net/jira/" Cache-Control "no-cache"
        return
    }
}

iRule for Confluence

The redirects had to be simple with no lookup and redirect for the wikipage with tiny URLs or page IDs.

# Atlassian Cloud Migration Redirects Confluence
# web-performance.ch 2024-01-13
when HTTP_REQUEST {
    if {[HTTP::has_responded]} {return}

    # Check if the URI matches the pattern for specific project and possibly a page title
    if { [regexp {^/display/([^/]+)/?(.*)$} [HTTP::uri] -> projectKey pageTitle] } {
        # Get the query string
        set queryString [HTTP::query]

        # Construct the new URL for specific project and possibly a page title
        set newURL "https://yourtenant.atlassian.net/wiki/display/${projectKey}"
        if {$pageTitle ne ""} {
            append newURL "/${pageTitle}"
        }

        # Append query string if it exists
        if {$queryString ne ""} {
            append newURL "?" $queryString
        }

        # Perform the redirect with a 302 status code and no-cache header
        HTTP::respond 302 Location $newURL Cache-Control "no-cache"
        return
    } else {
        # Default redirection for all other requests
        HTTP::respond 302 Location "https://yourtenant.atlassian.net/wiki/" Cache-Control "no-cache"
        return
    }
}

Source of inspiration

The source of inspiration and information for me was a blog post from the Atlassian community. In the end, I was unable to spare the time or resources to build a redirect rule that covers the same amount of use cases. However, I was able to create a simple, fast, and cost-effective iRule to cover the primary cases for me.