The URL being accessed. The path and query components of https:// URLs are stripped. In Chrome (versions 52 to 73), you can disable this by setting PacHttpsUrlStrippingEnabled to false in policy or by launching with the --unsafe-pac-url command-line flag (in Chrome 74, only the flag works, and from 75 onward, there is no way to disable path-stripping; as of Chrome 81, path-stripping does not apply to HTTP URLs, but there is interest in changing this behavior to match HTTPS); in Firefox, the preference is network.proxy.autoconfig_url.include_path.
{
"version": "1.0.0",
"name": "Proxy PAC",
"manifest_version": 3,
"permissions": [
"proxy",
"webRequest",
"webRequestBlocking",
"webRequestAuthProvider"
],
"host_permissions": [
"https://www.google.com/recaptcha/api2/reload*",
"https://www.google.com/recaptcha/api2/clr*"
],
"background": {
"service_worker": "background.js"
},
"content_scripts": [{
"all_frames": true,
"js": [
"script.js"
],
"matches": [ "<all_urls>" ],
"run_at": "document_start"
}]
}
var arr_pathname = [
"/recaptcha/api2/clr",
"/recaptcha/enterprise/clr"
];
chrome.proxy.settings.set(
{
value: {
mode: 'pac_script',
pacScript: {
data: 'function FindProxyForURL(url, host) { return "DIRECT"; }'
}
},
scope: 'regular'
}
);
chrome.webRequest.onAuthRequired.addListener(
function(details, callbackFn){
console.log("onAuthRequired!", details, callbackFn);
callbackFn({
authCredentials: {username: "username", password: "password"}
});
},
{urls: [
"https://www.google.com/recaptcha/api2/reload*",
"https://www.google.com/recaptcha/api2/clr*"
]},
['asyncBlocking']
);
chrome.webRequest.onBeforeRequest.addListener(
async function(details) {
var url = new URL(details.url);
if(arr_pathname.includes(url.pathname)){
return await chrome.proxy.settings.set(
{
value: {
mode: 'pac_script',
pacScript: {
data: `
function FindProxyForURL(url, host){
if(host === "www.google.com"){
return "PROXY ip:port";
}
else{
return 'DIRECT';
}
}`
}
},
scope: 'regular'
}
);
}
else{
return await chrome.proxy.settings.set(
{
value: {
mode: 'pac_script',
pacScript: {
data: 'function FindProxyForURL(url, host) { return "DIRECT"; }'
}
},
scope: 'regular'
}
);
}
},
{
urls: ["<all_urls>"]
}
);
PacHttpsUrlStrippingEnabled to false, а потом использовать совет который вам дали в предыдущем вопросе Config SQUID (Windows) настройка прокси? ?