Cisco Cisco Web Security Appliance S360 Guía Para Resolver Problemas

Descargar
Página de 5
The following function determines the connection type by specifying days of the week that are appropriate for
a proxy. Days that do not fall between these parameters use a direct connection. This function could be useful
in situations where you might want to use a proxy when traffic is heavy and allow a direct connection when
traffic is light.
function FindProxyForURL(url, host)
 {
 if(weekdayRange("WED", "SAT", "GMT"))
 return "PROXY proxy:80";
 else
 return "DIRECT";
 }
The weekdayRange(day1 [,day2] [,GMT] ) function returns whether the current system time falls within the
range specified by the parameters day1, day2, and GMT. Only the first parameter is required. The GMT
parameter presumes time values are in Greenwich Mean Time rather than the local time zone.
Example 11: Load Balancing with a simple Math function
function FindProxyForURL(url, host){
return randomProxy();
}
function randomProxy()
{
switch( Math.floor( Math.random() *2))
{
case 0: return "PROXY 1.1.1.1:3128; PROXY 2.2.2.2; PROXY DIRECT;"
case 1: return "PROXY 2.2.2.2:3128; PROXY 1.1.1.1; PROXY DIRECT;"
}
}
You will see that the cases also implement a failover in case one proxy is not available.
Updated: Jul 24, 2014
Document ID: 118076