Autoproxy Function of CCProxy

2017/04/14 19:22

How to Combine Two Internet Access Lines with CCProxy

Here the autoproxy function of CCProxy can make this work.

Theory: Suppose there are two servers, each of them are with an Internet access line and installed CCProxy, one of both is the main server, client's setting is "Use automatic configuration script", thus it's possible to adjust and allocate the clients' Internet access line reasonably by using autoproxy script (PAC)of CCProxy on the servers. All these adjusting operations only need to be done on servers, not clients.


Client settings: 

In Internet Explorer (version after v5.0), "Tool"->"Internet Options"->"Connections"->"LAN Settings"->"Use automatic configuration script", here type into "http://192.168.1.253:8888" (Figure 1).

Client Configuration

Figure 1

Main proxy server settings:

1. Make a port mapping in CCProxy, set "autoproxy" as its destination address, "local port" and "destination port" are port 8888 (Figure 2),

Figure 2

2. Then create a PAC script, name it as "autoproxy.pac", save it to the installation directory of CCProxy. Suppose the IP address of the main server is 192.168.1.253 (Figure 3).


Figure 3


Edit autoproxy script (PAC) (Figure 4):

function FindProxyForURL(url, host)

{

if (isPlainHostName(host))

{

//Indicate the local IP address without using proxy server

return "DIRECT";

}

else

{

//Use Proxy Server

return randomProxy();

}

}

function randomProxy()

{

switch( Math.floor( Math.random() * 2 ) )

{

case 0:

return "PROXY 192.168.1.253:808";

break;

case 1:

return "PROXY 192.168.1.254:808";

break;

}

}

Edit the PAC file and make changes to the cases. 

Note: if you have more than 2 proxy servers then make changes as required and add more cases.


Figure 4


How to Change Proxy Ports only on Server and No Need to Do Any Changes on Client

Other settings are the same with mentioned abovedifferent is the PAC:

function FindProxyForURL(url, host)

{

if (isPlainHostName(host))

{

//Indicate the local IP address without using proxy server

return "DIRECT";

}

else

{

//Use Proxy Server

// You can change the proxy port 808 here.

return "PROXY 192.168.0.1:808";

}

}

How to Make Different Websites Use Different Proxy Servers or Not Use Proxy Server by Auto Proxy

function FindProxyForURL(url, host)

{

if (isPlainHostName(host))

return "DIRECT";

else if (shExpMatch(host,"*.com"))

return "PROXY 192.168.0.2:808";

else if (shExpMatch(host,"www.tsinghua.edu.cn"))

return "PROXY proxy.edu.cn:808";

else

return "PROXY 192.168.0.1:808";

}

}




Related:

Live Chat