From 4e37707a07120a126a8b057d43bc8fa54f2df7a9 Mon Sep 17 00:00:00 2001 From: Ivaylo Novakov Date: Wed, 5 Aug 2020 14:42:10 +0300 Subject: [PATCH] Add a hard 307 redirect. --- handshake-api/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/handshake-api/index.js b/handshake-api/index.js index f92ccf05..896514fb 100644 --- a/handshake-api/index.js +++ b/handshake-api/index.js @@ -69,6 +69,9 @@ server.use( proxy("nginx", { // eslint-disable-next-line no-unused-vars userResHeaderDecorator(headers, userReq, userRes, proxyReq, proxyRes) { + if (!userReq.path.endsWith("/")) { + userRes.redirect(307, `${userReq.path}/`); + } if (headers.location && headers.location.match(startsWithSkylinkRegExp)) { headers.location = headers.location.replace(startsWithSkylinkRegExp, `/hns/${userReq.params.name}`); }