Skip to content

Commit

Permalink
Update regex to replace the url correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronaldo Macapobre committed Feb 7, 2025
1 parent 0049335 commit 0aac51f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aws/lambdas/auth/authorizer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ const generatePolicy = (
{
Action: "execute-api:Invoke",
Effect: effect,
// Replaces resource (Http Method and path) with wildcard to take advantage of caching
Resource: resource.replace(/\/[^/]+$/, "/*"),
// Replace everything after stage with wildcard
Resource: resource.replace(/(.*?\/\w+)\/.*/, "$1/*"),
},
],
};
Expand Down

0 comments on commit 0aac51f

Please sign in to comment.