I am trying to build a chrome extension which can change proxy settings when the fire up the browser. I have followed the chrome extension documentation but still no success.
manifest.json
{
"manifest_version": 2,
"name": "Proxy",
"description": "Proxy on 127.0.0.1:8080",
"version": "1.1",
"background": {
"scripts":["background.js"]
},
"browser_action": {
"default_icon": "icon.png",
"popup":"popup.html"
},
"permissions": [
"tabs",
"http://*/*",
"https://*/*",
"notifications",
"contextMenus",
"history",
"background",
"proxy"
],
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
}
backround.js
chrome.windows.onCreated.addListener(function() {
var config = {
mode: "fixed_servers",
rules: {
proxyForHttp: {
scheme: "http",
host: "127.0.0.1",
port:"8080"
},
bypassList: ["foobar.com"]
}
};
chrome.proxy.settings.set(
{value: config, scope: 'regular'},
function() {});
});
The above code doesn't works…
Best Answer
Change the line
port:"8080"
toport:8080
and it'll work.Nicety
You can check effective settings at chrome://net-internals/#proxy.Nicety
If via PAC script, on script code error,
chrome.proxy.settings.set
handler still runs even as the proxy fails silently. This can be detected at chrome://net-internals/#events.Nicety
This page claims that console.log messages in your PAC script can be found in net log, but it doesn't seem to work.