Merge pull request #1851 from SkynetLabs/adjust-health-checks-to-skylink-redirects
fix health checks working with root domain skylink and hns redirects
This commit is contained in:
commit
8db71f57ec
|
@ -201,7 +201,11 @@ async function genericAccessCheck(name, url) {
|
||||||
const data = { up: false, url };
|
const data = { up: false, url };
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await got(url, { headers: { cookie: `nocache=true;${authCookie}` } });
|
const cookie = `nocache=true;${authCookie}`;
|
||||||
|
const response = await got(url, {
|
||||||
|
headers: { cookie },
|
||||||
|
hooks: { beforeRedirect: [(options) => (options.headers.cookie = cookie)] },
|
||||||
|
});
|
||||||
|
|
||||||
data.statusCode = response.statusCode;
|
data.statusCode = response.statusCode;
|
||||||
data.up = true;
|
data.up = true;
|
||||||
|
|
|
@ -1023,13 +1023,27 @@ function fileEndpointCheck(done) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// check whether hns/note-to-self would properly redirect to note-to-self/
|
// check whether hns/note-to-self would properly redirect to note-to-self/
|
||||||
function hnsEndpointDirectoryRedirect(done) {
|
function skylinkRootDomainEndpointRedirect(done) {
|
||||||
const expected = {
|
const expected = {
|
||||||
name: "hns endpoint directory redirect",
|
name: "skylink root domain endpoint redirect",
|
||||||
skylink: "hns/note-to-self",
|
skylink: "AACogzrAimYPG42tDOKhS3lXZD8YvlF8Q8R17afe95iV2Q",
|
||||||
statusCode: 308,
|
statusCode: 301,
|
||||||
headers: {
|
headers: {
|
||||||
location: "note-to-self/",
|
location: `https://000ah0pqo256c3orhmmgpol19dslep1v32v52v23ohqur9uuuuc9bm8.${process.env.PORTAL_DOMAIN}`,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
skylinkVerification(done, expected, { followRedirect: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
// check whether hns/note-to-self would properly redirect to note-to-self/
|
||||||
|
function hnsRootDomainEndpointRedirect(done) {
|
||||||
|
const expected = {
|
||||||
|
name: "hns root domain endpoint redirect",
|
||||||
|
skylink: "hns/note-to-self",
|
||||||
|
statusCode: 301,
|
||||||
|
headers: {
|
||||||
|
location: `https://note-to-self.hns.${process.env.PORTAL_DOMAIN}`,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1136,7 +1150,12 @@ async function skylinkVerification(done, expected, { followRedirect = true, meth
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const query = `https://${process.env.PORTAL_DOMAIN}/${expected.skylink}`;
|
const query = `https://${process.env.PORTAL_DOMAIN}/${expected.skylink}`;
|
||||||
const response = await got[method](query, { followRedirect, headers: { cookie: `nocache=true;${authCookie}` } });
|
const cookie = `nocache=true;${authCookie}`;
|
||||||
|
const response = await got[method](query, {
|
||||||
|
followRedirect,
|
||||||
|
headers: { cookie },
|
||||||
|
hooks: { beforeRedirect: [(options) => (options.headers.cookie = cookie)] },
|
||||||
|
});
|
||||||
const entry = { ...details, up: true, statusCode: response.statusCode, time: calculateElapsedTime(time) };
|
const entry = { ...details, up: true, statusCode: response.statusCode, time: calculateElapsedTime(time) };
|
||||||
const info = {};
|
const info = {};
|
||||||
|
|
||||||
|
@ -1237,7 +1256,8 @@ module.exports = [
|
||||||
// uniswapHNSRedirectCheck,
|
// uniswapHNSRedirectCheck,
|
||||||
uniswapHNSResolverCheck,
|
uniswapHNSResolverCheck,
|
||||||
uniswapHNSResolverRedirectCheck,
|
uniswapHNSResolverRedirectCheck,
|
||||||
hnsEndpointDirectoryRedirect,
|
skylinkRootDomainEndpointRedirect,
|
||||||
|
hnsRootDomainEndpointRedirect,
|
||||||
skappSkySend,
|
skappSkySend,
|
||||||
skappNoteToSelf,
|
skappNoteToSelf,
|
||||||
skappUniswap,
|
skappUniswap,
|
||||||
|
|
Reference in New Issue