From ed3fba1db4d968e90b30ffbe077dce72d8dbf395 Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 10 Mar 2022 09:54:54 +0100 Subject: [PATCH] Revert "Merge pull request #1851 from SkynetLabs/adjust-health-checks-to-skylink-redirects" This reverts commit 8db71f57ec6ffd2db25e2febb59c84ff42c11cd3, reversing changes made to 7922f84a237657b3dfb8aae09e5dbed32081f5f8. --- packages/health-check/src/checks/critical.js | 6 +--- packages/health-check/src/checks/extended.js | 32 ++++---------------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/packages/health-check/src/checks/critical.js b/packages/health-check/src/checks/critical.js index 9eec00fb..127ebd8a 100644 --- a/packages/health-check/src/checks/critical.js +++ b/packages/health-check/src/checks/critical.js @@ -201,11 +201,7 @@ async function genericAccessCheck(name, url) { const data = { up: false, url }; try { - const cookie = `nocache=true;${authCookie}`; - const response = await got(url, { - headers: { cookie }, - hooks: { beforeRedirect: [(options) => (options.headers.cookie = cookie)] }, - }); + const response = await got(url, { headers: { cookie: `nocache=true;${authCookie}` } }); data.statusCode = response.statusCode; data.up = true; diff --git a/packages/health-check/src/checks/extended.js b/packages/health-check/src/checks/extended.js index bf8d4b99..aaf74389 100644 --- a/packages/health-check/src/checks/extended.js +++ b/packages/health-check/src/checks/extended.js @@ -1023,27 +1023,13 @@ function fileEndpointCheck(done) { } // check whether hns/note-to-self would properly redirect to note-to-self/ -function skylinkRootDomainEndpointRedirect(done) { +function hnsEndpointDirectoryRedirect(done) { const expected = { - name: "skylink root domain endpoint redirect", - skylink: "AACogzrAimYPG42tDOKhS3lXZD8YvlF8Q8R17afe95iV2Q", - statusCode: 301, - headers: { - 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", + name: "hns endpoint directory redirect", skylink: "hns/note-to-self", - statusCode: 301, + statusCode: 308, headers: { - location: `https://note-to-self.hns.${process.env.PORTAL_DOMAIN}`, + location: "note-to-self/", }, }; @@ -1150,12 +1136,7 @@ async function skylinkVerification(done, expected, { followRedirect = true, meth try { const query = `https://${process.env.PORTAL_DOMAIN}/${expected.skylink}`; - const cookie = `nocache=true;${authCookie}`; - const response = await got[method](query, { - followRedirect, - headers: { cookie }, - hooks: { beforeRedirect: [(options) => (options.headers.cookie = cookie)] }, - }); + const response = await got[method](query, { followRedirect, headers: { cookie: `nocache=true;${authCookie}` } }); const entry = { ...details, up: true, statusCode: response.statusCode, time: calculateElapsedTime(time) }; const info = {}; @@ -1256,8 +1237,7 @@ module.exports = [ // uniswapHNSRedirectCheck, uniswapHNSResolverCheck, uniswapHNSResolverRedirectCheck, - skylinkRootDomainEndpointRedirect, - hnsRootDomainEndpointRedirect, + hnsEndpointDirectoryRedirect, skappSkySend, skappNoteToSelf, skappUniswap,