fix(http): preserve CORS tracing allow headers - #9795
Conversation
|
@codex review |
Overall package sizeSelf size: 8.15 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.3 | 125.43 kB | 441.68 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 481723b | Docs | Datadog PR Page | Give us feedback! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 62ddd89b5e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #9795 +/- ##
==========================================
- Coverage 98.56% 98.52% -0.04%
==========================================
Files 972 975 +3
Lines 140837 142796 +1959
Branches 12116 12163 +47
==========================================
+ Hits 138811 140687 +1876
- Misses 2026 2109 +83 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
64ee21d to
9bcb63d
Compare
BenchmarksBenchmark execution time: 2026-08-13 15:48:58 Comparing candidate commit 481723b in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 2317 metrics, 41 unstable metrics.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9bcb63d1bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22a1e39ba3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
What does this PR do?
Updates CORS preflight handling so tracing headers merged into
access-control-allow-headersare also written back to explicit headers passed through the second or thirdServerResponse.writeHead()argument.The explicit header collection is handled case-insensitively and retains Node.js object or flat-array form. Calls that do not need an allow-list update continue to receive their original arguments unchanged.
Motivation
Node.js gives headers passed directly to
writeHead()precedence over values previously set withres.setHeader(). As a result, an application-provided value such ascontent-typecould overwrite the computedcontent-type,baggageallow-list and cause the browser preflight to fail.Additional Notes
Validation:
./node_modules/.bin/mocha packages/dd-trace/test/plugins/util/web.spec.js— 81 passing./node_modules/.bin/mocha packages/datadog-plugin-http/test/server.spec.js— 56 passingweb.js— 91.86% linesgit diff --checkand syntax checks pass