-
Notifications
You must be signed in to change notification settings - Fork 412
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
fix(event_handler): CORS Origin for ALBResolver multi-headers #4385
fix(event_handler): CORS Origin for ALBResolver multi-headers #4385
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4385 +/- ##
===========================================
- Coverage 96.38% 96.26% -0.12%
===========================================
Files 214 218 +4
Lines 10030 10449 +419
Branches 1846 1861 +15
===========================================
+ Hits 9667 10059 +392
- Misses 259 273 +14
- Partials 104 117 +13 ☔ View full report in Codecov by Sentry. |
Hey @leandrodamascena thanks for the fix ;) When you've got time could you update the PR body to explain what the actual fix is? |
Many thanks. I will take a look into the fix. |
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.
Two quick changes as I head to the airport.
-
Use our internality utility function to get case insensitive headers
-
Revisit origin headers extraction logic placement
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.
Tiny change to remove unnecessary branching (if I understood it right)
|
Hi guys! Your changelog indicates that this issue was resolved in the release 2.39.0. However, the fix is not present in 2.39.0 or in 2.39.1. Can you clarify when we can expect it? |
Hello @pseudochaos! I see this fix in version 2.39.0, but do you mean it's not working as expected? Can you give more details about this please? |
Hi @leandrodamascena! Yes, it's not working as expected or as it was working in app = APIGatewayRestResolver(strip_prefixes=['/foo'], cors=CORSConfig()) and this is how I specify the dependency - return Response(headers={'Access-Control-Allow-Origin': '*'}, body=...) |
Just to make sure I understand the point here: you are migrating from Porwertools v1 to v2, correct? I'm opening an issue on your behalf and we can discuss more there. It might be interesting if you provide some code snippet and the result you expect from it. |
@pseudochaos can you please add more information in this issue? |
Issue number: #4327
Summary
Changes
AWS offers various integration options for Lambda, such as ALB, REST API, HTTP API, Lambda URL, and others. These integrations have different payloads, and when working with ALB and multi-headers, we were unable to add CORS as it only considered a header single value.
With this fix, we can now work with both single and multi-header scenarios without any issues. Additionally, the fix looks for Origin/origin header in both single-value and multi-value headers, providing a more comprehensive and robust solution for handling different types of request headers.
User experience
There is no change in the user experience, this is a bug.
Checklist
If your change doesn't seem to apply, please leave them unchecked.
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.