Skip to content

Commit 3dc6ab5

Browse files
committed
try again
1 parent cbbb51d commit 3dc6ab5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/middleware.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@ export const onRequest: MiddlewareHandler = async ({ request }, next) => {
1010
const normalizedPath = url.pathname.toLowerCase().replace(/\/$/, '');
1111

1212
if (url.pathname !== normalizedPath) {
13-
const redirectUrl = `${url.origin}${normalizedPath}${url.search}`;
14-
return Response.redirect(redirectUrl, 301);
13+
const redirectUrl = `${normalizedPath}${url.search}`;
14+
return new Response(null, {
15+
status: 301,
16+
headers: {
17+
Location: redirectUrl,
18+
},
19+
});
1520
}
1621
}
1722

0 commit comments

Comments
 (0)