Skip to content

Commit

Permalink
fix(lambda-at-edge): handle trailing slash index.html page in reconst…
Browse files Browse the repository at this point in the history
…ructOriginalRequestUri (#1832)
  • Loading branch information
dphang committed Oct 13, 2021
1 parent 0626694 commit 1926eb2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/libs/lambda-at-edge/src/default-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,11 @@ const reconstructOriginalRequestUri = (
manifest.trailingSlash ? "/" : ""
)}`;

// For index.html page, it will become "/index", which is not a route so normalize it to "/"
originalUri = originalUri.replace(/\/index$/, "/");
// For index.html page, it will become "/index" or "/index/", which is not a route so normalize it to "/"
originalUri = originalUri.replace(
manifest.trailingSlash ? /\/index\/$/ : /\/index$/,
"/"
);

return originalUri;
};
Expand Down

0 comments on commit 1926eb2

Please sign in to comment.