-
Notifications
You must be signed in to change notification settings - Fork 24
feat(core): add additive CORS configuration fields #2941
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(core): add additive CORS configuration fields #2941
Conversation
|
/gemini review |
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.
Code Review
This pull request introduces a valuable feature by adding additive CORS configuration fields, allowing operators to extend default lists without replacing them. The implementation is robust, including correct handling of case-insensitive headers, comprehensive unit and integration tests, and clear documentation. I have one suggestion to refactor the slice merging logic to reduce code duplication, which would enhance maintainability. Overall, this is a well-executed and beneficial change.
Add `additionalheaders`, `additionalmethods`, and `additionalexposedheaders`
fields to CORS config, allowing operators to append custom values without
replacing the entire default list.
- Add mergeStringSlices() for case-sensitive method deduplication
- Add mergeHeaderSlices() for case-insensitive header deduplication (RFC 7230)
- Add Effective*() methods to compute merged values at runtime
- Log effective CORS values at startup for operator visibility
- Add unit tests for merge functions and Effective* methods
- Update docs/Configuring.md with CORS configuration section
Operators can now add custom headers without copying all defaults:
```yaml
server:
cors:
additionalheaders:
- X-Custom-Header
Backwards compatible: existing configs work unchanged.
b3b0226 to
41bf81e
Compare
Proposed Changes
Add
additionalheaders,additionalmethods, andadditionalexposedheadersfields to CORS config, allowing operators to append custom values without
replacing the entire default list.
Operators can now add custom headers without copying all defaults:
Backwards compatible: existing configs work unchanged.
Checklist
Testing Instructions