Skip to content
This repository was archived by the owner on Jan 28, 2025. It is now read-only.

Commit 36e5716

Browse files
authored
fix(lambda-at-edge): fix redirect loop in Next 10.0.4 and up due to new internal redirect regexes (#879)
1 parent da2da19 commit 36e5716

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

packages/libs/lambda-at-edge/src/routing/redirector.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ export function isTrailingSlashRedirect(
2020
redirect: RedirectData,
2121
basePath: string
2222
) {
23+
// Remove internal trailing slash redirects (in Next.js 10.0.4 and up)
24+
if (redirect.internal === true) {
25+
return true;
26+
}
27+
2328
if (basePath !== "") {
2429
return (
2530
(redirect.statusCode === 308 &&

packages/libs/lambda-at-edge/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ export type RedirectData = {
127127
source: string;
128128
destination: string;
129129
regex: string;
130+
internal?: boolean;
130131
};
131132

132133
export type RewriteData = {

0 commit comments

Comments
 (0)