Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(chromium): disable BlockOriginHeaderModificationOnRedirect (#41696)

Yury Semikhatsky6a9bd5a0f813
diff --git a/packages/playwright-core/src/server/chromium/chromiumSwitches.ts b/packages/playwright-core/src/server/chromium/chromiumSwitches.ts
index aade807fc3..7543642c62 100644
--- a/packages/playwright-core/src/server/chromium/chromiumSwitches.ts
+++ b/packages/playwright-core/src/server/chromium/chromiumSwitches.ts
@@ -36,6 +36,9 @@ const disabledFeatures = [
'PaintHolding',
// See https://github.com/microsoft/playwright/issues/32230
'ThirdPartyStoragePartitioning',
+ // Chromium 149 rejects re-applying the `origin` header on a redirect (as request interception
+ // does) with net::ERR_INVALID_ARGUMENT. See https://github.com/microsoft/playwright/issues/41690
+ 'BlockOriginHeaderModificationOnRedirect',
// See https://github.com/microsoft/playwright/issues/16126
'Translate',
// See https://issues.chromium.org/u/1/issues/435410220
diff --git a/tests/page/page-request-continue.spec.ts b/tests/page/page-request-continue.spec.ts
index 4226f7374b..48f9458012 100644
--- a/tests/page/page-request-continue.spec.ts
+++ b/tests/page/page-request-continue.spec.ts
@@ -872,6 +872,35 @@ it('propagate headers cross origin redirect after interception', {
expect.soft(serverRequest.headers['custom']).toBe('foo');
});
+it('continue should pass on 307 cross-origin redirect', {
+ annotation: { type: 'issue', description: 'https://github.com/microsoft/playwright/issues/41690' }
+}, async ({ page, server, isAndroid }) => {
+ it.skip(isAndroid, 'No cross-process on Android');
+
+ server.setRoute('/final', (request, response) => {
+ response.writeHead(200, { 'content-type': 'text/html' });
+ response.end('<!doctype html><title>final</title><p>ok</p>');
+ });
+ // Cross-origin 307 redirect that preserves the POST method.
+ server.setRoute('/redirect307', (request, response) => {
+ response.writeHead(307, { location: `${server.PREFIX}/final` });
+ response.end();
+ });
+
+ await page.goto(server.PREFIX + '/empty.html');
+ await page.setContent(`
+ <form id="f" method="POST" action="${server.CROSS_PROCESS_PREFIX}/redirect307">
+ <input type="submit">
+ </form>`);
+
+ await page.route('**/*', route => route.continue());
+ await Promise.all([
+ page.waitForURL(`${server.PREFIX}/final`),
+ page.locator('input').click(),
+ ]);
+ await expect(page.locator('p')).toHaveText('ok');
+});
+
it('should intercept css variable with background url', async ({ page, server }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/19158' });