Artica provides load-balancing and failover capabiliteis to your proxy.pac script by retrinving the last byte of the IP Address and return the Modulo division (%) with the number of Proxy server.
Example:
var myip=myIpAddress();
var ipBits = myip.split(".");
// Retrieve the last byte of IP address
var mySeg = parseInt(ipBits[3]);
switch (mySeg % 2) {
case 0: return "PROXY artica-postfix.articatech.lab:50877;PROXY 192.168.58.1:8080; DIRECT";
case 1: return "PROXY 192.168.58.1:8080;PROXY artica-postfix.articatech.lab:50877; DIRECT";
}
In this example we have two Proxy servers, so:
case 0: return "PROXY artica-postfix.articatech.lab:50877;PROXY 192.168.58.1:8080; DIRECT";
case 1: return "PROXY 192.168.58.1:8080;PROXY artica-postfix.articatech.lab:50877; DIRECT";
case 0: return "PROXY artica-postfix.articatech.lab:50877;PROXY 192.168.58.1:8080; DIRECT";
This method can be used for any number of Proxy servers.