Improve CORS defaults and upstream header forwarding#1653
Open
Improve CORS defaults and upstream header forwarding#1653
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1653 +/- ##
===========================================
+ Coverage 47.81% 72.59% +24.77%
===========================================
Files 382 408 +26
Lines 8525 12273 +3748
Branches 3159 3518 +359
===========================================
+ Hits 4076 8909 +4833
+ Misses 3070 2344 -726
+ Partials 1379 1020 -359
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
arseny-kostenko
approved these changes
Apr 10, 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.
Description
Hardens the proxy server's CORS configuration and upstream response header handling.
cors()now usesorigin: trueinstead of the default*. When noOriginheader is present (same-origin or non-browser clients), noAccess-Control-Allow-Originheader is set.GETandPOSTare advertised, matching the actual routes defined in the proxy.maxAge: 86400reduces redundant OPTIONS requests in cross-origin scenarios (e.g., local development).content-typeandcontent-encodingare forwarded from upstream database responses. Previously all headers were forwarded, which could clobber the proxy's own CORS headers and leak hop-by-hop headers that should not be forwarded by a proxy (RFC 7230 §6.1).Validation
app.test.tscovering origin reflection, no-origin behavior, method restriction, preflight caching, and the upstream header allowlistpnpm checkspassesCheck List
pnpm checkspasses with no errors.pnpm testpasses with no failures.