How to customize Error Page in Confluence Data Center

FlyMajster
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 10, 2023

Hi!
I'm jira admin and I would like to customize Error Page in Confluence 7.19
I would like the user who does not have access to the specific page to receive information on the Error page who to contact for access.

Thanks for all answers 

1 answer

1 accepted

2 votes
Answer accepted
Matt
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.
October 10, 2023

There are a few ways this can be accomplished, none of which are easy. Meaning that they will all require some type of code customization, there's no GUI settings to customize application templates.

  1. Custom HTML
  2. A new Theme or custom in-house plugin using the JAVA API
  3. A 3rd party plugin
    1. ScriptRunner (paid add-on)
  4. Directly modifying the error template files (personally, I do not recommend this because it requires application files to be overwritten during any application upgrades. but if you're ok with as part of your upgrades/builds then this is a documented solution)

On Server/DC you can use the 'Custom HTML' feature within the application's General Config to add some HTML/JS logic to determine if you're on the Error page and display your custom message. Unfortunately, there's no way to determine who the space admin is, through the REST API, so what you can do is just make it clearer for the user to find who that is and inform them to reach out to them.

Here's an example:

const initCustomErrorMessage = () => {
// if .request-access div exists, we're on the 401 page, so append more details
if($('div.request-access').length > 0) {
let errorMsg = '<h3>Please reach out to a Space Administrator to request access to this resource</h3>. <p>To learn who the space administrators are for this space, click <a href="https://'+ window.location.host +'/spaces/viewspacesummary.action?key='+AJS.params.spaceKey+'">here</a>.</p>';
$('div.request-access').append(errorMsg);
}
}


AJS.toInit(function () {
initCustomErrorMessage();
})


The above solution will not work for Confluence Cloud

FlyMajster
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 10, 2023

Thank you for your reply.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events