It is common practice for proxy companies to use session IDs inside the proxy user credential string to provide session control and keep the same IP for multiple requests.
Quick example using an Oxylabs proxy (one of the biggest proxy networks):
Host and port are static: "pr.oxylabs.io:7777"
The proxy user credentials are dynamic: "customer-USERNAME-sessid-randomString123:PASSWORD"
Switching the "randomString123" in front of the "sessid" changes your session and with that also your IP.
Now here comes the problem with using these proxy sessions inside your chrome extension:
Once you set your proxy via "chrome.proxy.settings.set" and submit your user credentials via "chrome.webRequest.onAuthRequired.addListener" Chrome will no longer ask for new user credentials. It saves your user credentials/session ID/IP for the currently set proxy host and keeps using them.
How do we force a re-authentication of the proxy so we can submit a new username and switch our session/IP?
Here's all the possible solutions I found:
I wasn't able to find any more solutions. If you know another solution please let me know.
So far for me it looks like there's not a single proper lightweight solution to force a proxy re-authentication in order to do what basically all major proxy providers make use of: Controlling your session via the username string.
It would be really useful if we could have a "chrome.proxy" method to delete our currently saved proxy authentication details.
Let me know what you think or if you have any questions.