I would like to ask your assistance on how I can possibly redirect properly the Error 500 Internal Server page only to a custom page and otherwise our webpage will be accessible. Currently, I have a code but even our system is accessible it's still redirecting to a custom page
My background.js
function redirect(requestDetails) {
console.log("Redirecting: " + requestDetails.url);
return {
redirectUrl: "https://cmms.domainhosting.com/cmms/ma.html"
};
}
chrome.webRequest.onBeforeRequest.addListener(
redirect,
{urls:["http://cmms/may/ui"]},
["blocking"]
);
My manifest
{
"description": "Intercept and Redirect Error 500 Page",
"manifest_version": 2,
"name": "Web Request",
"version": "12.8.2018",
"icons": {
"24": "icons/24.png",
"48": "icons/48.png",
"128": "icons/128.png"
},
"browser_action": {
"default_icon": "icons/48.png"
},
"permissions": [
"webRequest",
"webRequestBlocking",
"http://cmms/may/"
],
"background": {
"scripts": ["background.js"]
}
}
I have read that onBeforeRedirect can achieve my needs but I don't have any idea how to code it.
Thanks!