exclude local addresses in wpad

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have a proxy Ubuntu 18.04, with squid 3128 and apache2, and I publish the auto configuration file proxy.pac with the option dhcp 252.
The file has the following contents:
function FindProxyForURL(url, host) return "PROXY 192.168.0.10:3128";
There are applications on some computers within my local network that have these urls for access:
http://localhost:8080
http://192.168.0.12:8090/app/bar
The problem is squid has restrictions on this type of request
How can I configure the proxy.pac to exclude requests to local addresses? (example: 192.168.0.0/24 or localhost:port)
Important to note that a temporary solution is to manually put the ip:port of the proxy in the browsers (in Windows: Control Panel/Internet Options), and select the box "do not use proxy server for local addresses", but then the proxy.pac would not make sense.
dhcp squid http-proxy
add a comment |Â
up vote
1
down vote
favorite
I have a proxy Ubuntu 18.04, with squid 3128 and apache2, and I publish the auto configuration file proxy.pac with the option dhcp 252.
The file has the following contents:
function FindProxyForURL(url, host) return "PROXY 192.168.0.10:3128";
There are applications on some computers within my local network that have these urls for access:
http://localhost:8080
http://192.168.0.12:8090/app/bar
The problem is squid has restrictions on this type of request
How can I configure the proxy.pac to exclude requests to local addresses? (example: 192.168.0.0/24 or localhost:port)
Important to note that a temporary solution is to manually put the ip:port of the proxy in the browsers (in Windows: Control Panel/Internet Options), and select the box "do not use proxy server for local addresses", but then the proxy.pac would not make sense.
dhcp squid http-proxy
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a proxy Ubuntu 18.04, with squid 3128 and apache2, and I publish the auto configuration file proxy.pac with the option dhcp 252.
The file has the following contents:
function FindProxyForURL(url, host) return "PROXY 192.168.0.10:3128";
There are applications on some computers within my local network that have these urls for access:
http://localhost:8080
http://192.168.0.12:8090/app/bar
The problem is squid has restrictions on this type of request
How can I configure the proxy.pac to exclude requests to local addresses? (example: 192.168.0.0/24 or localhost:port)
Important to note that a temporary solution is to manually put the ip:port of the proxy in the browsers (in Windows: Control Panel/Internet Options), and select the box "do not use proxy server for local addresses", but then the proxy.pac would not make sense.
dhcp squid http-proxy
I have a proxy Ubuntu 18.04, with squid 3128 and apache2, and I publish the auto configuration file proxy.pac with the option dhcp 252.
The file has the following contents:
function FindProxyForURL(url, host) return "PROXY 192.168.0.10:3128";
There are applications on some computers within my local network that have these urls for access:
http://localhost:8080
http://192.168.0.12:8090/app/bar
The problem is squid has restrictions on this type of request
How can I configure the proxy.pac to exclude requests to local addresses? (example: 192.168.0.0/24 or localhost:port)
Important to note that a temporary solution is to manually put the ip:port of the proxy in the browsers (in Windows: Control Panel/Internet Options), and select the box "do not use proxy server for local addresses", but then the proxy.pac would not make sense.
dhcp squid http-proxy
dhcp squid http-proxy
edited Sep 25 at 0:34
Goro
6,39552863
6,39552863
asked Sep 24 at 23:14
user4839775
9412
9412
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Change the function to this:
function FindProxyForURL(url,host)
var hostIP;
if (isIpV4Addr.test (host))
hostIP = host;
else
hostIP = dnsResolve(host);
if (isInNet(hostIP, "192.168.0.0", "255.255.255.0"))
return "DIRECT";
if (host == "localhost")
return "DIRECT";
return "PROXY 192.168.0.10:3128";
This first checks whether the host part is an IPv4 number. If so, that is directly used as the IP.
If not, the host part is resolved to an IP address and the result is used.
It then matches the IP address against the specified subnet; if that matches, the browser is instructed to directly access the host.
If the hostname is "localhost", the browser is also instructed to directly access the host (although I wonder whether browsers will ever use this function for "localhost").
Finally, the default is to use the proxy.
A masterpiece Thank you very much. Only a small detail. It works well in chrome, but not in firefox. Any suggestions?
â user4839775
Sep 25 at 13:28
This should work in any browser, including Internet Explorer, Edge, and also firefox. Check your webserver logs to see if firefox is actually loading the wpad file.
â wurtel
Sep 25 at 13:38
Your pac file answers my question (that's why I select it as correct), however it compromises navigation. I will ask the question again.
â user4839775
Sep 25 at 20:09
New question unix.stackexchange.com/questions/471423/â¦
â user4839775
Sep 25 at 20:57
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Change the function to this:
function FindProxyForURL(url,host)
var hostIP;
if (isIpV4Addr.test (host))
hostIP = host;
else
hostIP = dnsResolve(host);
if (isInNet(hostIP, "192.168.0.0", "255.255.255.0"))
return "DIRECT";
if (host == "localhost")
return "DIRECT";
return "PROXY 192.168.0.10:3128";
This first checks whether the host part is an IPv4 number. If so, that is directly used as the IP.
If not, the host part is resolved to an IP address and the result is used.
It then matches the IP address against the specified subnet; if that matches, the browser is instructed to directly access the host.
If the hostname is "localhost", the browser is also instructed to directly access the host (although I wonder whether browsers will ever use this function for "localhost").
Finally, the default is to use the proxy.
A masterpiece Thank you very much. Only a small detail. It works well in chrome, but not in firefox. Any suggestions?
â user4839775
Sep 25 at 13:28
This should work in any browser, including Internet Explorer, Edge, and also firefox. Check your webserver logs to see if firefox is actually loading the wpad file.
â wurtel
Sep 25 at 13:38
Your pac file answers my question (that's why I select it as correct), however it compromises navigation. I will ask the question again.
â user4839775
Sep 25 at 20:09
New question unix.stackexchange.com/questions/471423/â¦
â user4839775
Sep 25 at 20:57
add a comment |Â
up vote
1
down vote
accepted
Change the function to this:
function FindProxyForURL(url,host)
var hostIP;
if (isIpV4Addr.test (host))
hostIP = host;
else
hostIP = dnsResolve(host);
if (isInNet(hostIP, "192.168.0.0", "255.255.255.0"))
return "DIRECT";
if (host == "localhost")
return "DIRECT";
return "PROXY 192.168.0.10:3128";
This first checks whether the host part is an IPv4 number. If so, that is directly used as the IP.
If not, the host part is resolved to an IP address and the result is used.
It then matches the IP address against the specified subnet; if that matches, the browser is instructed to directly access the host.
If the hostname is "localhost", the browser is also instructed to directly access the host (although I wonder whether browsers will ever use this function for "localhost").
Finally, the default is to use the proxy.
A masterpiece Thank you very much. Only a small detail. It works well in chrome, but not in firefox. Any suggestions?
â user4839775
Sep 25 at 13:28
This should work in any browser, including Internet Explorer, Edge, and also firefox. Check your webserver logs to see if firefox is actually loading the wpad file.
â wurtel
Sep 25 at 13:38
Your pac file answers my question (that's why I select it as correct), however it compromises navigation. I will ask the question again.
â user4839775
Sep 25 at 20:09
New question unix.stackexchange.com/questions/471423/â¦
â user4839775
Sep 25 at 20:57
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Change the function to this:
function FindProxyForURL(url,host)
var hostIP;
if (isIpV4Addr.test (host))
hostIP = host;
else
hostIP = dnsResolve(host);
if (isInNet(hostIP, "192.168.0.0", "255.255.255.0"))
return "DIRECT";
if (host == "localhost")
return "DIRECT";
return "PROXY 192.168.0.10:3128";
This first checks whether the host part is an IPv4 number. If so, that is directly used as the IP.
If not, the host part is resolved to an IP address and the result is used.
It then matches the IP address against the specified subnet; if that matches, the browser is instructed to directly access the host.
If the hostname is "localhost", the browser is also instructed to directly access the host (although I wonder whether browsers will ever use this function for "localhost").
Finally, the default is to use the proxy.
Change the function to this:
function FindProxyForURL(url,host)
var hostIP;
if (isIpV4Addr.test (host))
hostIP = host;
else
hostIP = dnsResolve(host);
if (isInNet(hostIP, "192.168.0.0", "255.255.255.0"))
return "DIRECT";
if (host == "localhost")
return "DIRECT";
return "PROXY 192.168.0.10:3128";
This first checks whether the host part is an IPv4 number. If so, that is directly used as the IP.
If not, the host part is resolved to an IP address and the result is used.
It then matches the IP address against the specified subnet; if that matches, the browser is instructed to directly access the host.
If the hostname is "localhost", the browser is also instructed to directly access the host (although I wonder whether browsers will ever use this function for "localhost").
Finally, the default is to use the proxy.
answered Sep 25 at 9:44
wurtel
9,46511324
9,46511324
A masterpiece Thank you very much. Only a small detail. It works well in chrome, but not in firefox. Any suggestions?
â user4839775
Sep 25 at 13:28
This should work in any browser, including Internet Explorer, Edge, and also firefox. Check your webserver logs to see if firefox is actually loading the wpad file.
â wurtel
Sep 25 at 13:38
Your pac file answers my question (that's why I select it as correct), however it compromises navigation. I will ask the question again.
â user4839775
Sep 25 at 20:09
New question unix.stackexchange.com/questions/471423/â¦
â user4839775
Sep 25 at 20:57
add a comment |Â
A masterpiece Thank you very much. Only a small detail. It works well in chrome, but not in firefox. Any suggestions?
â user4839775
Sep 25 at 13:28
This should work in any browser, including Internet Explorer, Edge, and also firefox. Check your webserver logs to see if firefox is actually loading the wpad file.
â wurtel
Sep 25 at 13:38
Your pac file answers my question (that's why I select it as correct), however it compromises navigation. I will ask the question again.
â user4839775
Sep 25 at 20:09
New question unix.stackexchange.com/questions/471423/â¦
â user4839775
Sep 25 at 20:57
A masterpiece Thank you very much. Only a small detail. It works well in chrome, but not in firefox. Any suggestions?
â user4839775
Sep 25 at 13:28
A masterpiece Thank you very much. Only a small detail. It works well in chrome, but not in firefox. Any suggestions?
â user4839775
Sep 25 at 13:28
This should work in any browser, including Internet Explorer, Edge, and also firefox. Check your webserver logs to see if firefox is actually loading the wpad file.
â wurtel
Sep 25 at 13:38
This should work in any browser, including Internet Explorer, Edge, and also firefox. Check your webserver logs to see if firefox is actually loading the wpad file.
â wurtel
Sep 25 at 13:38
Your pac file answers my question (that's why I select it as correct), however it compromises navigation. I will ask the question again.
â user4839775
Sep 25 at 20:09
Your pac file answers my question (that's why I select it as correct), however it compromises navigation. I will ask the question again.
â user4839775
Sep 25 at 20:09
New question unix.stackexchange.com/questions/471423/â¦
â user4839775
Sep 25 at 20:57
New question unix.stackexchange.com/questions/471423/â¦
â user4839775
Sep 25 at 20:57
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f471202%2fexclude-local-addresses-in-wpad%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password