diff --git a/src/launch-context.ts b/src/launch-context.ts index 1e9a788..477e5df 100644 --- a/src/launch-context.ts +++ b/src/launch-context.ts @@ -111,7 +111,17 @@ export class LaunchContext< * Use `undefined` to unset existing proxy URL. */ set proxyUrl(url: string | undefined) { - this._proxyUrl = url && new URL(url).href; + if (!url) { + return; + } + + const urlInstance = new URL(url); + urlInstance.pathname = '/'; + urlInstance.search = ''; + urlInstance.hash = ''; + + // https://www.chromium.org/developers/design-documents/network-settings/#command-line-options-for-proxy-settings + this._proxyUrl = urlInstance.href.slice(0, -1); } /** diff --git a/test/browser-plugins/plugins.test.ts b/test/browser-plugins/plugins.test.ts index 27405f0..3d94d3e 100644 --- a/test/browser-plugins/plugins.test.ts +++ b/test/browser-plugins/plugins.test.ts @@ -66,7 +66,7 @@ const runPluginTest = < id, launchOptions, browserPlugin: plugin, - _proxyUrl: proxyUrl, + _proxyUrl: proxyUrl.slice(0, -1), one: 1, useIncognitoPages: false, };