【发布时间】:2022-06-20 23:55:44
【问题描述】:
当我想在我的扩展程序中设置代理时,我使用 chrome.proxy.settings.set() 然后我用
chrome.webRequest.onAuthRequired.addListener(callbackFn, {urls: ['<all_urls>']}, ['blocking']);
const callbackFn = (details: any) => {
const username = 'someUser';
const password = 'somePass';
return {authCredentials: {username, password}};
}
但 5 分钟后,我想使用另一个用户凭据。当我设置 proxy.settings.clear({}) - 那是明确的代理,我有我的默认 IP。之后我设置代理,设置新的 onAuthRequired 侦听器,但是 chrome 将我的第一个凭据保存在某个地方,我无法通过 onAuthRequired 更改它,因为 chrome 将我的第一个凭据设置为代理服务器的标头。 如何从 chrome 中删除我之前设置的凭据?
我认为 chrome 保存了与服务器的连接。因为代理仅在 chrome 重新打开后才要求信用。 如何关闭与代理服务器的连接(通过 chrome API)?
【问题讨论】:
标签: google-chrome-extension http-proxy