feat(server-ng): honor [http.cors] config on the HTTP listener#3646
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3646 +/- ##
=============================================
- Coverage 73.47% 21.16% -52.32%
Complexity 937 937
=============================================
Files 1286 1283 -3
Lines 141019 122433 -18586
Branches 116908 98367 -18541
=============================================
- Hits 103619 25917 -77702
- Misses 34175 95737 +61562
+ Partials 3225 779 -2446
🚀 New features to boost your workflow:
|
The listener deserialized [http.cors] (shipped with enabled = true) but never read it: no CorsLayer was installed, so browser clients were blocked and every cors field in the config was silently dead. Port the legacy server's mapping: empty origin list = tower-http default, leading "*" = any origin, otherwise an explicit allow-list; entries are trimmed, blank ones dropped, and an unknown method fails the boot loudly instead of passing through as a custom token. Unlike the legacy port, configs tower-http rejects by panicking (a "*" origin past the first position, or allow_credentials combined with a wildcard origin, header, or expose list) fail as InvalidConfiguration, and cors is validated before bind so a bad config never prints the "started" log or opens the socket. The layer is outermost because server-ng authenticates per route: a preflight OPTIONS carries no Authorization and matches no method route, so it must be answered before dispatch. Also expose x-iggy-view instead of the "" placeholder so browser clients can read the view header cross-origin.
c8127fc to
299b568
Compare
numinnex
approved these changes
Jul 12, 2026
spetz
approved these changes
Jul 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The listener deserialized [http.cors] (shipped with
enabled = true) but never read it: no CorsLayer was
installed, so browser clients were blocked and every cors
field in the config was silently dead.
Port the legacy server's mapping: empty origin list =
tower-http default, leading "*" = any origin, otherwise
an explicit allow-list; entries are trimmed, blank ones
dropped, and an unknown method fails the boot loudly
instead of passing through as a custom token.
Unlike the legacy port, configs tower-http rejects by
panicking (a "*" origin past the first position, or
allow_credentials combined with a wildcard origin,
header, or expose list) fail as InvalidConfiguration,
and cors is validated before bind so a bad config never
prints the "started" log or opens the socket.
The layer is outermost because server-ng authenticates
per route: a preflight OPTIONS carries no Authorization
and matches no method route, so it must be answered
before dispatch. Also expose x-iggy-view instead of the
"" placeholder so browser clients can read the view
header cross-origin.