Skip to content

fix(fetch): apply proxy.bypass to redirect targets - #42848

Merged
Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-42815
Sep 22, 2026
Merged

Yury Semikhatsky (yury-s) merged 2 commits into
microsoft:mainfrom
yury-s:fix-42815

Conversation

@yury-s

Copy link
Copy Markdown
Member

Summary

  • Resolve the proxy agent per redirect hop instead of reusing the one chosen for the original URL, so proxy.bypass applies to redirect targets.
  • Resolve client certificates in the same place, so all URL-scoped request options are derived per hop.

Fixes #42815

The proxy agent was chosen once from the original URL and reused for
every redirect hop, so a redirect target was proxied or bypassed based
on the first URL instead of its own host. Resolve the agent per hop.

Fixes: microsoft#42815
… agent

Derive all URL-scoped request options in one place in _sendRequest and
drop the unused agent field from the redirect options type.
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

9 flaky ⚠️ [chromium-library] › library/beforeunload.spec.ts:130 › should support dismissing the dialog multiple times `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/video.spec.ts:690 › screencast › should capture full viewport `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:373 › should produce network events, routing, and annotations for Service Worker `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/video.spec.ts:725 › screencast › should capture full viewport on hidpi `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:96 › should batch watch updates `@windows-latest-node22`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:778 › should partition action tree state by test `@windows-latest-node22`
⚠️ [playwright-test] › ui-mode-trace.spec.ts:827 › should update state on subsequent run `@windows-latest-node22`

52084 passed, 1252 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

2 failed
❌ [chrome] › mcp/cli-webmcp.spec.ts:188 › webmcp-call disambiguates same-name tools in identical same-origin frames @mcp-ubuntu-latest-chrome
❌ [firefox] › mcp/cli-session.spec.ts:54 › idle timeout shuts the session down @mcp-windows-latest-firefox

8690 passed, 1474 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I am the Playwright bot and I took a first look at the red CI here.

🟢 Both failures are known flakes — this PR is clear

cli-webmcp.spec.ts:188 and cli-session.spec.ts:54 both flip verdict across unrelated SHAs in the CI results database, and neither goes anywhere near fetch.ts proxy resolution. The tests 1 report has no failures at all, only 9 flaky.

Details

This PR touches packages/playwright-core/src/server/fetch.ts (per-redirect-hop proxy agent and client-cert resolution) and tests/library/fetch-proxy.spec.ts. That code path is only reachable from APIRequestContext; the MCP CLI tests that failed do not exercise it. The PR's own new proxy tests passed.

Pre-existing flake / infra

Triaged by the Playwright bot - agent run

Sign up for free to 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.

[Bug]: APIRequestContext evaluates proxy.bypass only for the first URL, so redirect targets use the wrong route

3 participants