Revert "Add a hard 307 redirect."

This reverts commit 4c46465e46.
This commit is contained in:
Ivaylo Novakov 2020-08-04 19:39:25 +03:00
parent 4c46465e46
commit b12c1674e4
No known key found for this signature in database
GPG Key ID: 06B9354AB08BE9C6
1 changed files with 0 additions and 17 deletions

View File

@ -68,9 +68,6 @@ server.use(
proxy("nginx", { proxy("nginx", {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
userResHeaderDecorator(headers, userReq, userRes, proxyReq, proxyRes) { userResHeaderDecorator(headers, userReq, userRes, proxyReq, proxyRes) {
if (!userReq.path.endsWith("/")) {
userRes.redirect(307, `${userReq.path}/`);
}
if (headers.location && headers.location.match(startsWithSkylinkRegExp)) { if (headers.location && headers.location.match(startsWithSkylinkRegExp)) {
headers.location = headers.location.replace(startsWithSkylinkRegExp, `/hns/${userReq.params.name}`); headers.location = headers.location.replace(startsWithSkylinkRegExp, `/hns/${userReq.params.name}`);
} }
@ -99,20 +96,6 @@ server.use(
}) })
); );
// server.get("/hns/:name", async (req, res) => {
// if (!req.path.endsWith('/')) {
// res.redirect(307, `${req.path}/`);
// }
// console.log(" > ", req.path)
// if (req.headers.location && req.headers.location.match(startsWithSkylinkRegExp)) {
// req.headers.location = req.headers.location.replace(startsWithSkylinkRegExp, `/hns/${userReq.params.name}`);
// console.log(" > to ", req.headers.location)
// }
//
// // res.redirect(307, '/to');
//
// return req.headers;
// });
server.get("/hnsres/:name", resolveDomainHandler); server.get("/hnsres/:name", resolveDomainHandler);
server.listen(port, host, (error) => { server.listen(port, host, (error) => {