-
Notifications
You must be signed in to change notification settings - Fork 153
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
feat: Allow CORS policy to be configured #484
Conversation
@korylprince ...Requesting if this can also be back-ported to the |
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! looks great
Head branch was pushed to by a user without write access
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #484 +/- ##
==========================================
- Coverage 60.29% 60.20% -0.10%
==========================================
Files 78 78
Lines 6753 6775 +22
==========================================
+ Hits 4072 4079 +7
- Misses 2385 2399 +14
- Partials 296 297 +1 ☔ View full report in Codecov by Sentry. |
@muhlemmer thanks for taking a look at this! I pushed a new commit that I think works around this issue nicely. Instead of wrapping the *webServer itself for CORS, keep an internal handler that can either be the router or the CORS-wrapped router, and use that in ServeHTTP. |
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.
Perfect, thanks!
🎉 This PR is included in version 3.3.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
hey @korylprince thanks for the contribution. If you'd like to have a small gift in return, please send us a mail to hi@zitadel.com. We will send you a form with questions about your address and shirt size. |
This allows the CORS policy to be configured or disabled on an
op.Provider
viaWithCORSOptions
or onon.RegisterServer
viaWithServerCORSOptions
. The reason for this feature is library users may want a stricter CORS policy than the default policy currently forced by the library.This takes care not to break backwards compatibility with any interfaces, functions, or default usage (e.g. the default policy is still applied by default).
Also, this removes the CORS middleware from the
intercept
function as every upstream use of it already had the CORS middleware applied.