PAC ( Automatic Proxy Configuration ) Script Not working with Safari MacOS version 15.1

We have written a PAC script that blocklists certain domains and whitelists others. We went to Settings > Network > Wi-Fi (the network we are using), then clicked on Details, and under Proxies, we added the PAC file URL in the Automatic Proxy Configuration section.

We tried hosting the PAC file both on localhost and on a separate HTTP server.

After saving the settings, we tested several URLs. The blocking and allowing behavior works correctly in all browsers except Safari.

Below is the PAC script we are using for your reference. The script works as expected in browsers other than Safari.

This is how the PAC script URL looks:

http://localhost:31290/proxy.pac
function FindProxyForURL(url, host) {
  var blacklist = new Set(["facebook.com", "deepseek.com"]);
  var b_list = [...blacklist];

  for (let i = 0; i < b_list.length; i++) {
    let ele = b_list[i] + "*";
    if (shExpMatch(host, ele) || shExpMatch(url, ele)) {
      return "PROXY localhost:8086";
    }
  }

  if (isIPBlocked(whitelist_subnet, hostIP)) {
    return "PROXY localhost:8087";
  }
  if (isIPBlocked(blacklist_subnet, hostIP)) {
    return "PROXY localhost:8086";
  }

  return "PROXY localhost:8080";
}

It looks like part of the PAC file might be missing - in particular, I don't see isIPBlocked defined. Can you confirm whether the full file was attached?

function FindProxyForURL(url, host) {
  var blacklist = new Set(["facebook.com", "deepseek.com", "www.deepseek.com"]);
  var b_list = [...blacklist];

  for (let i = 0; i < b_list.length; i++) {
    let ele = b_list[i] + "*";
    if (shExpMatch(host, ele) || shExpMatch(url, ele)) {
      return "PROXY localhost:8086";
    }
  }

  return "PROXY localhost:8080";
}

Hi, this is the full basic code that does the blocking. The function isIPBlocked ( just a checking code )is not needed, and even the above blocking code is not working in Safari. We would like to know if the PAC script is supported in Safari ? This script is working in other browsers.

PAC ( Automatic Proxy Configuration ) Script Not working with Safari MacOS version 15.1
 
 
Q