How to delete Proxy-Authorization Cache on Chrome extension?

限于喜欢 提交于 2021-01-28 04:51:43

问题


I am building a "proxy client" extension for chrome and i have following scenario:

  • Users can login to the extension and get a token from API. Tokens are valid for 2 hours.
  • After login users can select a proxy server from a list and that proxy is set with chrome.proxy api.
  • I am using Squid on proxy servers. When a user connects to a proxy server and lands on onAuthRequired i return email and token as authCredentials.

Chrome uses those credentials from cache until token is not valid anymore and proxy server responses "407, Proxy Authentication Required". Now the problem i am facing here is when i login with another username on same browser and connect to same proxy server it still sends old users credentials to the server because they are still valid. My question is how can delete chromes proxy auth cache so that it lands onAuthRequired again and i can return new users Credentials.

I tried to modify the response from proxy server to "407, Proxy Authentication Required" when user makes his first request over the proxy server to force a onAuthRequired but its not working. Chrome still uses cache and still returns credentials from old user to the proxy server.


回答1:


Have you tried to hook up another event handler within the webRequest API in order to manipulate the http headers before Chrome takes on authentication?

E.g. onBeforeSendHeaders or onHeadersReceived



来源:https://stackoverflow.com/questions/36869999/how-to-delete-proxy-authorization-cache-on-chrome-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!