Skip to content

fix(fetch): use case-insensitive host header lookup on redirect - #41850

Merged
Dmitry Gozman (dgozman) merged 1 commit into
microsoft:mainfrom
dgozman:fix-41766
Jul 17, 2026
Merged

fix(fetch): use case-insensitive host header lookup on redirect#41850
Dmitry Gozman (dgozman) merged 1 commit into
microsoft:mainfrom
dgozman:fix-41766

Conversation

@dgozman

Copy link
Copy Markdown
Collaborator

Summary

  • The redirect handler updated the host header via headers['host'] (lowercase-only lookup), while header names preserve their original casing. A Host header set through extraHTTPHeaders was never updated on redirect.
  • Now uses the case-insensitive setHeader() helper, consistent with getHeader/removeHeader in the same file.

Fixes#41766

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

5 flaky⚠️ [chromium-library] › library/video.spec.ts:664 › screencast › should capture full viewport `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:699 › screencast › should capture full viewport on hidpi `@realtime-time-library-chromium-linux`
⚠️ [firefox-library] › library/inspector/cli-codegen-3.spec.ts:255 › cli codegen › should generate frame locators (4) `@firefox-ubuntu-22.04-node20`

50370 passed, 1158 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [chromium] › mcp/annotate.spec.ts:497 › should disengage annotate mode when --annotate client disconnects @mcp-macos-latest-chromium

7759 passed, 1249 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures.

🟢 The one failure is a pre-existing flake — this PR is clear

mcp/annotate.spec.ts:497 failed on chromium, but it flakes on its own across unrelated SHAs, and this PR only touches fetch redirect header handling — nothing the MCP annotate flow exercises.

Details

This PR changes packages/playwright-core/src/server/fetch.ts to use a case-insensitive Host header lookup on redirect (plus the matching test). The only reported failure is in the MCP annotate suite, which doesn't go anywhere near APIRequestContext redirects.

Pre-existing flake / infra

  • [chromium] › mcp/annotate.spec.ts:497 › should disengage annotate mode when --annotate client disconnects — pre-existing flake. Across the test-results DB it flips verdict on every browser: chromium failed 2 of 265 runs, webkit 9/268, firefox 8/261, chrome 5/266 (passed the rest). The two chromium failures are on PR feat(test runner): cancel operations on test end via default abort signal #41707 (run 29078064409) and a push commit (run 29406325712, sha e0e814de) — both unrelated to this PR, so it can't be responsible.

The tests 1 report had 5 flaky, 0 failed, which also don't touch fetch redirects.

Triaged by the Playwright bot - agent run

@dgozman
Dmitry Gozman (dgozman) merged commit beff82d into microsoft:mainJul 17, 2026
47 of 48 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Case-sensitive host header lookup in fetch redirect breaks cross-origin requests with custom headers

2 participants

@dgozman@Skn0tt