-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Path resolution for API Gateway custom domain base path mapping #16
Comments
hey thanks for this great issue @DanSchoppe Using lambda-proxy/lambda_proxy/proxy.py Line 551 in dfb2148
we could do something like
This would need to be tested |
Yes, I'm on board with statically using Is it possible in API Gateway to configure a wildcard variable name different than I'd be happy to PR this change if you'd like. It could even be a one-liner, falling back to event.path if event.pathParameters.proxy didn't exist:
|
I'll open the PR and start testing |
I don't think so but that could be a problem if it does |
well I lied you can put whatever you want. Not sure what we should do about it, make it configurable or just mention that we force |
Thanks for testing this! A couple thoughts:
Regarding your PR comment #17 (comment)
I guess I don't fully understand. Is this because there is no |
I found a solution to support any variable. The
Yes
No they don't because they are not considered as {proxy+}. I'll show how to overrule this. |
Hi @vincentsarago! I ran into a pretty weird quirk when attempting to put a proxy Lambda endpoint behind a custom domain with base path mapping. I thought it might be useful to add a workaround fix to this repo. Let me explain...
For example, I have:
abcdef123456.execute-api.us-east-1.amazonaws.com
{proxy+}
Lambda resolver (it's a tile server 😄)foo.danschoppe.com
/tiler
-> deployed Lambda stageWith this setup, one would expect a request to
abcdef123456.execute-api.us-east-1.amazonaws.com/bar
to behave identically to a request tofoo.danschoppe.com/tiler/bar
. Unfortunately, as described in CodeGenieApp/serverless-express#216, the value ofevent.path
for the custom domain erroneously includes the'tiler/'
prefix from the base path mapping. So in first request the value ofevent.path
is'bar'
, and in the second request the value ofevent.path
is'tiler/bar'
.This looks to be a quirk of API Gateway where the
event.path
includes the base path mapping of a custom domain. As you can imagine, this breaks the routing of a project likelambda-proxy
.As folks in the aforementioned issue realized,
event.pathParameters.proxy
is a more reliable source of route information thanevent.path
for this scenario. In the examples above, both requests result in aevent.pathParameters.proxy
value of'bar'
.What are your thoughts on adding support to optionally use
event.pathParameters.proxy
for route matching? The option could be configured via environment variable, such that it can be determined at deploy time.Thanks for your thoughts!
The text was updated successfully, but these errors were encountered: