-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
move parse_service_name after serve_edge_router_rules #11800
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
Conversation
LocalStack Community integration with Pro 2 files 2 suites 1h 54m 44s ⏱️ Results for commit 1e89601. ♻️ This comment has been updated with latest results. |
d675ef8
to
7254b0c
Compare
7254b0c
to
1e89601
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely great to see this change finally happening 😍 🦸🏽
Thanks a lot for keeping an eye on this, and bringing this up again! 💯
handlers.validate_request_schema, # validate request schema for public LS endpoints | ||
handlers.serve_localstack_resources, # try to serve endpoints in /_localstack | ||
handlers.serve_edge_router_rules, | ||
# start aws handler chain | ||
handlers.parse_service_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: This absolutely minimal change is the result of a lot of work. Thanks for staying at it, absolutely fantastic to see this moving down! 💯 🥳
Motivation
This PR moves our ServiceNameParser to be executed after our Edge Router.
Note: this will break upstream until #11801 and its companion are merged, so should be reviewed together.
For historical reasons, we needed the service name for our security handling (we talk about CORS, but it is not about CORS, CORS is a "response" part, this is about our CRSF/firewall? security where we reject a request if not in our allowed hosts).
It however lead to some issues because every route would be considered as an S3 request, as our service name could not parse the request.
As S3 now properly manages its own CORS via a special handler executed very early in the request chain, we already know before the service name parser if an S3 request that needs to have its CORS managed is an S3 request or not via some heuristics.
I believe the burden to find solutions for CORS is on the self-managed CORS services, and not for every edge route to have to find a way not to be an S3 request via the
localstack.aws.protocol.service_router.legacy_rules
orcustom_path_addressing_rules
.Currently we do have solutions for both S3 and API Gateway, so I think now is the time to finally jump the gun so we don't have CORS issues with any of external routes: they will all be managed by our default CORS/security handling.
As a side effect, we also will see less issues where the stream of a route would have been consumed by our ServiceNameParser 😄
Follow-up would be to clean the
service_router.legacy_rules
because most of them are there because of CORS/security issues.Changes
Testing
run #/13565727990 (failing due to APIGW, fixed with #11801 and upstream PR)