From f2d00f2ad9a8b424ed93102e9988f6c3158e8b48 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 22 Dec 2020 21:36:42 -0500 Subject: [PATCH] Revert "Revert "remove unnecessary redirect in server"" This reverts commit 63d8f1731ea5322afdf992373b62d5efbbd576c2. --- web/middleware/redirect.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/web/middleware/redirect.js b/web/middleware/redirect.js index b170392ef..c7e130c8f 100644 --- a/web/middleware/redirect.js +++ b/web/middleware/redirect.js @@ -5,6 +5,7 @@ async function redirectMiddleware(ctx, next) { const requestHost = ctx.host; const path = ctx.path; const url = ctx.url; + // Getting err: too many redirects on some urls because of this // Need a better solution // const decodedUrl = decodeURIComponent(url); @@ -14,11 +15,6 @@ async function redirectMiddleware(ctx, next) { // return; // } - if (path.endsWith('/') && path.length > 1) { - ctx.redirect(url.replace(/\/$/, '')); - return; - } - if (!path.startsWith('/$/') && path.match(/^([^@/:]+)\/([^:/]+)$/)) { ctx.redirect(url.replace(/^([^@/:]+)\/([^:/]+)(:(\/.*))/, '$1:$2')); // test against path, but use ctx.url to retain parameters return;