Skip to content

Commit cc3cec3

Browse files
authored
Merge pull request #224 from logandk/bug/base-path-stripping-v2-event
Support base path stripping for v2 events
2 parents 600b4af + fb91022 commit cc3cec3

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

serverless_wsgi.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ def handle_payload_v2(app, event, context):
244244
script_name = get_script_name(headers, event.get("requestContext", {}))
245245

246246
path_info = event["rawPath"]
247+
base_path = os.environ.get("API_GATEWAY_BASE_PATH")
248+
if base_path:
249+
script_name = "/" + base_path
250+
251+
if path_info.startswith(script_name):
252+
path_info = path_info[len(script_name) :]
247253

248254
body = event.get("body", "")
249255
body = get_body_bytes(event, body)

0 commit comments

Comments
 (0)