You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An external API Gateway v2 HTTP has a route /prefix/public/{proxy+} integrated with the lambda.
An internal ALB has a listener rule /prefix/private/* integrated with the lambda.
Requests to <api gateway url>/prefix/public/foo arrive in the lambda and public_foo_function is called, as expected.
From within my VPC, internal requests to <alb url>/prefix/private/bar arrive in the lambda and Starlette returns Not Found 404. This is unexpected.
As a workaround, if I change the private route in Starlette app from /private/bar to /prefix/private/bar, private_bar_function is called.
Considerations
api_gateway_base_path does have 'api gateway' in the name, and ALB is not an API Gateway. So there's an argument it could be intentional?
But, I expected mangum to behave consistently for all of its supported input events.
The text was updated successfully, but these errors were encountered:
api_gateway_base_path does have 'api gateway' in the name, and ALB is not an API Gateway. So there's an argument it could be intentional?
I'm not sure if it is intentional or not. API Gateway was originally the only supported event source and ALB support came long after the api_gateway_base_path setting was first included, so it's possible that those contributors of the ALB support assumed to ignore the setting due to the api_gateway_* prefix in the setting name.
Should we replace api_gateway_base_path with a single base_path configuration that behaves the same way for the ALB handler?
Summary
api_gateway_base_path
argument to strip the prefix of the http path before passing to the underlying appapi_gateway_base_path
works as expected for API Gateway eventsapi_gateway_base_path
does not work for ALB events.I looked at https://mangum.io/http/ and the GitHub issues and couldn't find this mentioned anywhere.
My Setup
Simplified version of my lambda handler:
An external API Gateway v2 HTTP has a route
/prefix/public/{proxy+}
integrated with the lambda.An internal ALB has a listener rule
/prefix/private/*
integrated with the lambda.Requests to
<api gateway url>/prefix/public/foo
arrive in the lambda andpublic_foo_function
is called, as expected.From within my VPC, internal requests to
<alb url>/prefix/private/bar
arrive in the lambda and Starlette returnsNot Found
404. This is unexpected.As a workaround, if I change the private route in Starlette app from
/private/bar
to/prefix/private/bar
,private_bar_function
is called.Considerations
api_gateway_base_path
does have 'api gateway' in the name, and ALB is not an API Gateway. So there's an argument it could be intentional?But, I expected mangum to behave consistently for all of its supported input events.
The text was updated successfully, but these errors were encountered: