0

I have this wpad.pac

function FindProxyForURL(url, host) {
if (isPlainHostName(host) ||
    shExpMatch(host, "*.local") ||
    isInNet(dnsResolve(host), "192.168.0.0", "255.255.255.0") ||
    isInNet(dnsResolve(host), "127.0.0.0", "255.255.255.0"))
    return "DIRECT";
return "PROXY 192.168.0.1:3128";
}

My server is Ubuntu 18.04.1 x64, with Squid Cache v3.5.27 (3128) and Apache v2.4.33, and I publish wpad.pac with the option dhcp 252:

option wpad code 252 = text;
option wpad \"http://192.168.0.1:3500/wpad.pac\";

and the file is stored in:

/var/www/html/wpad.pac

And it is published in the link:

http://192.168.0.1:3500/wpad.pac

Managed by apache with wpad.conf:

<VirtualHost *:3500>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/
<Directory />
    Options FollowSymLinks
    DirectoryIndex wpad.pac
    AllowOverride None
</Directory>
<Directory /var/www/html/>
    # serve proxy autoconfig correctly:
<Files "wpad.pac">
    AddType application/x-ns-proxy-autoconfig .pac
</Files>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride ALL
        Require all granted
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

And in ports.conf :

Listen 3500

And firewall rules:

iptables -t mangle -A PREROUTING -i enp2s0 -p tcp --dport 3500 -j ACCEPT
iptables -A INPUT -s 192.168.0.0/24 -i enp2s0 -p tcp --dport 3500 -j ACCEPT
iptables -A FORWARD -s 192.168.0.0/24 -i enp2s0 -p tcp --dport 3500 -j ACCEPT

And it works well with Chrome 69.0.3497.100, IE v11.0.9600.19100 and Opera 55.0.2994.61, but not with Mozilla Firefox 62.0.2 with the default configuration (I have not tested with Edge, but it's not relevant). However Mozilla loads the URL of wpad.pac well, but there is no navigation (It also does not work in previous versions).

What's wrong with my wpad.pac?

IMPORTANT:

  1. I do not want to have to specify the URL of wpad.pac in each Mozilla of my local network, since they are many computers. I would like you to take the configuration by default.

  2. Neither the smartphones with android detect my wpad (I have not tried with iphone)

  3. In some sites, they say that you have to disable ipv6 in Firefox ('about: config' network.dns.disableIPv6 to true). I already did it and that solution does not work.

  4. I have used these alternative wpad.pac files and they do not work with Firefox either

alternative1:

function FindProxyForURL(url, host)
{
if (isInNet(host, "192.168.0.0", "255.255.255.0"))
return "DIRECT";
else
return "192.168.0.1:3128";
}

alternative2:

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.1:3128";
}

alternative3:

function FindProxyForURL(url, host) {return "PROXY 192.168.0.1:3128";}

Thanks in advance

0

The problem was solved when upgrading to Firefox Quantum 63x

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.