From 7bfa6be62c51c733350f7473fdb24257639f3f2c Mon Sep 17 00:00:00 2001 From: Ray Lothian Date: Sun, 13 Nov 2022 06:36:17 -0500 Subject: [PATCH] fixes #160 --- v2/firefox/common.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/v2/firefox/common.js b/v2/firefox/common.js index 4ccaa4b..443efba 100644 --- a/v2/firefox/common.js +++ b/v2/firefox/common.js @@ -553,14 +553,19 @@ const onBeforeSendHeaders = d => { i < requestHeaders.length; i += 1, name = (requestHeaders[i] || {}).name ) { - if (name === 'User-Agent' || name === 'user-agent') { + name = name.toLowerCase(); + if (name === 'user-agent') { requestHeaders[i].value = str === 'empty' ? '' : str; - return { - requestHeaders - }; + } + // https://github.com/ray-lothian/UserAgent-Switcher/issues/160 + else if (name.startsWith('sec-ch-')) { + requestHeaders[i] = null; } } } + return { + requestHeaders: requestHeaders.filter(a => a) + }; }; const onCommitted = d => {