Skip to content

Commit

Permalink
fix: fix for non-root proxy+
Browse files Browse the repository at this point in the history
Co-authored-by: selvendran.ayyaswamy <[email protected]>
  • Loading branch information
selvendranayyaswamy and selvendran.ayyaswamy committed Aug 28, 2021
1 parent 50f83d0 commit 45edbfa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/event-sources/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ const url = require('url')
function getPathWithQueryStringParams ({
event,
query = event.multiValueQueryStringParameters,
// NOTE: Use `event.pathParameters.proxy` if available ({proxy+}); fall back to `event.path`
path = (event.pathParameters && event.pathParameters.proxy && `/${event.pathParameters.proxy}`) || event.path,
// NOTE: Always use event.path, if the API gateway has custom route setup, for example if my controllers path is
// something like employee/services/service1, employee/services/service2 etc, if I dont have any custom path/resources setup
// and directly have root/{proxy+} it works as expected, if i have a resource like /employee and child to that if there
// is a resource like {proxy+} it is not working as expected and errors out with 404. This change is required to address that
// specific issue.
path = event.path,
// NOTE: Strip base path for custom domains
stripBasePath = '',
replaceRegex = new RegExp(`^${stripBasePath}`)
Expand Down

0 comments on commit 45edbfa

Please sign in to comment.