From 1625f0a4fa307145c8e9e48ec64f31387311b98e Mon Sep 17 00:00:00 2001 From: Peter Shafer Date: Tue, 25 Jul 2023 09:13:19 -0700 Subject: [PATCH] Bugfix for trailing slash redirects when using pathPrefix option. --- server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index aad4c38..2996c23 100644 --- a/server.js +++ b/server.js @@ -280,7 +280,7 @@ class EleventyDevServer { if (indexHtmlExists && !url.endsWith("/")) { return { statusCode: 301, - url: url + "/", + url: u.pathname + "/", }; } @@ -288,7 +288,7 @@ class EleventyDevServer { if (htmlExists && url.endsWith("/")) { return { statusCode: 301, - url: url.substring(0, url.length - 1), + url: u.pathname.substring(0, u.pathname.length - 1), }; }