Add a hard 307 redirect.
This commit is contained in:
parent
98ec6f5c1c
commit
4e37707a07
|
@ -69,6 +69,9 @@ 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}`);
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue