*** setup information ***
- apache2 server (http server) ip address: 192.168.202.1
- proxy server ip address 192.168.202.25 port 3128
1- setup apache2 server to serve proxy.pac file
$ sudo apt-get install apache2
2- normally apache2 root directory is /var/www/html, so can create file /var/www/html/proxy.pac with the following content
function FindProxyForURL(url, host)
{
return "PROXY 192.168.202.25:3128";
}
- our proxy ip address 192.168.202.25 and use port 3128,
3- then on browser you can choose "use automatic configuration script" and type the url http://192.168.202.1/proxy.pac
the configuration should look like below
4- how when we use the browser with about configuration will use proxy 192.168.202.25 to internet
5- so if you have two of more proxy and want some subnet to use other proxy you can update the proxy.pac as below
function FindProxyForURL(url, host)
{
if (isInNet(host, "172.16.0.0", "255.255.254.0"))
{
return "PROXY 172.16.1.254:8080";
}
return "PROXY 192.168.202.25:3128";
}
- with configuration above if the client is in network 172.16.0.0/23, it will use proxy 172.16.1.254 port 8080 to go to internet.
No comments:
Post a Comment