Uh oh!
There was an error while loading. Please reload this page.
fix(fetch): use case-insensitive host header lookup on redirect - #41769
fix(fetch): use case-insensitive host header lookup on redirect#41769Rahul Rao (rahulrao85) wants to merge 2 commits into
Conversation
The redirect host header update used headers['host'] (lowercase only), but setHeader() preserves the original casing of header names. If extraHTTPHeaders set 'Host' (capital H), the redirect's host update was silently skipped. Now uses case-insensitive lookup like setHeader, getHeader, and removeHeader in the same file. Fixes: microsoft#41766
Dmitry Gozman (dgozman)
left a comment
There was a problem hiding this comment.
Thank you for the PR, this looks good.
Could you please use the helper function and update the should update host header on redirect test in tests/library/browsercontext-fetch.spec.ts to pass HosT instead of host?
Uh oh!
There was an error while loading. Please reload this page.
Test results for "MCP"3 failed 7757 passed, 1249 skipped Merge workflow run. |
Test results for "tests 1"9 flaky49676 passed, 1156 skipped Merge workflow run. |
Dmitry Gozman (dgozman)
commented
Jul 17, 2026
Closing as stale. |
Summary
The redirect host header update used \headers['host']\ (lowercase only), but \setHeader()\ preserves the original casing of header names. If \extraHTTPHeaders\ set 'Host'\ (capital H), the host was never updated on redirect, causing the request to be sent with the original origin's Host header.
Now uses case-insensitive lookup (\Object.keys().find()), consistent with \setHeader, \getHeader, and
emoveHeader\ in the same file.
Fixes: #41766