-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
implement ASF S3 CORS #7081
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
implement ASF S3 CORS #7081
Conversation
(Terraform tests are passing when overriding the ASF provider, see https://github.com/localstack/localstack/actions/runs/3322125332/jobs/5490831947) |
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.
Wow, this is huge! Thanks for grinding through this particularly complex topic! 🚀
I only have a few questions and some minor nitpicks.
Thanks a lot for the thorough review @alexrashed ! I've now pushed the changes that you pointed out, thanks again 🙏 |
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.
Thanks for addressing all the comments! It's really quite a complex topic. The code coverage goes down a bit, because the new provider isn't the default yet. But the tests are already in place (with lots of snapshots ❤️) and once we switch to the new provider (or add a new parallel test step for the new S3 provider) it will go up quite a bit! 🚀
I'd love to have a new parallel test step for the ASF provider once we know it's ready and out there for the public. If the code coverage is still too low after that, we can write more unit tests and/or integration on not covered parts. |
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.
fantastic! looks like we're almost there, just a merge conflict to fix :-)
I still can't seem to get a full green build, but it seems to be only a timeout related issue. This could be merged 🎉 |
This implements S3 CORS for the new provider.
Current issues with CORS is that we depend on the service name parser to correctly handle CORS depending on the service (S3 and API GW can both manage their own CORS rules).
We make use of the handler chain, with a very early handler which "pre-parse" the request with a simplified way to determine if the request would be directed towards S3. If it does, we then handle CORS based on the configured rules if there are, otherwise default to the LocalStack behaviour for CORS.
Here's a simplified flow chart for how we handle CORS.
(The top right box will actually differ depending on the previous path, but to simplify the chart, it is drawn as one path only).