Version
1.61.1
Steps to reproduce
Run this test on Chromium:
import http from 'node:http';
import { expect, test } from '@playwright/test';
test('route.continue should pass on 307 cross-origin redirect', async ({ page }) => {
const originPort = 3401;
const redirectPort = 3402;
const finalPort = 3403;
const finalServer = http.createServer((_req, res) => {
res.writeHead(200, { 'content-type': 'text/html' });
res.end('<!doctype html><title>final</title><p>ok</p>');
});
const redirectServer = http.createServer((_req, res) => {
res.writeHead(307, { location: `http://127.0.0.1:${finalPort}/` });
res.end();
});
const originServer = http.createServer((_req, res) => {
res.writeHead(200, { 'content-type': 'text/html' });
res.end(`<!doctype html><title>origin</title>
<form id="f" method="POST" action="http://127.0.0.1:${redirectPort}/">
<input type="submit">
</form>`);
});
finalServer.listen(finalPort, '127.0.0.1');
redirectServer.listen(redirectPort, '127.0.0.1');
originServer.listen(originPort, '127.0.0.1');
try {
await page.route('**/*', async (route) => { await route.continue(); });
await page.goto(`http://127.0.0.1:${originPort}/`);
await Promise.all([
page.waitForURL(`http://127.0.0.1:${finalPort}/`, { timeout: 2_000 }),
page.locator('input').click(),
]);
await expect(page.locator('p')).toHaveText('ok');
} finally {
originServer.close();
redirectServer.close();
finalServer.close();
}
});
Expected behavior
Test passes.
Actual behavior
Final page fails to load with ERR_INVALID_ARGUMENT.
Additional context
The reason for the failure is this Chromium change: https://chromium.googlesource.com/chromium/src.git/+/fd71efb820447671572c62544e3a93a78e8a6d7f, introduced in 149.0.7798.0.
The test passes if:
- the
page.route is removed,
- Chromium is launched with the extra arg
--disable-features=BlockOriginHeaderModificationOnRedirect, or
- the
Origin header is removed from the header overrides here:
|
headersOverride = removeCookieHeader(network.applyHeadersOverrides(originalHeaders, headersOverride)); |
Environment
Version
1.61.1
Steps to reproduce
Run this test on Chromium:
Expected behavior
Test passes.
Actual behavior
Final page fails to load with ERR_INVALID_ARGUMENT.
Additional context
The reason for the failure is this Chromium change: https://chromium.googlesource.com/chromium/src.git/+/fd71efb820447671572c62544e3a93a78e8a6d7f, introduced in 149.0.7798.0.
The test passes if:
page.routeis removed,--disable-features=BlockOriginHeaderModificationOnRedirect, orOriginheader is removed from the header overrides here:playwright/packages/playwright-core/src/server/chromium/crNetworkManager.ts
Line 349 in a061d96
Environment