Skip to content

Commit

Permalink
fix: treat request.uri as the path, not the URL
Browse files Browse the repository at this point in the history
  • Loading branch information
necipallef committed Apr 26, 2024
1 parent 5b47e51 commit 131f2b7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions proxy/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,8 @@ export function handleRequestWithRoutes(
customerVariables: CustomerVariables,
routes: Route[]
): Promise<CloudFrontResultResponse> {
const url = new URL(request.uri)
for (const route of routes) {
const matches = url.pathname.match(route.pathPattern)
const matches = request.uri.match(route.pathPattern)
if (matches) {
return route.handler(request, customerVariables, matches)
}
Expand Down
2 changes: 1 addition & 1 deletion proxy/test/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const mockRequest = (
return {
clientIp: '1.1.1.1',
method: method,
uri: `https://example.com/${uri}`,
uri,
querystring,
headers: {
host: [
Expand Down

0 comments on commit 131f2b7

Please sign in to comment.