I have this wpad.pac

function FindProxyForURL(url, host) {
if (isPlainHostName(host) ||
    shExpMatch(host, "*.local") ||
    isInNet(dnsResolve(host), "", "") ||
    isInNet(dnsResolve(host), "", ""))
    return "DIRECT";
return "PROXY";

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 \"\";

and the file is stored in:


And it is published in the link:

Managed by apache with wpad.conf:

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

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

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

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 -i enp2s0 -p tcp --dport 3500 -j ACCEPT
iptables -A FORWARD -s -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?


  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


function FindProxyForURL(url, host)
if (isInNet(host, "", ""))
return "DIRECT";
return "";


function FindProxyForURL(url,host) {
var hostIP;
if (isIpV4Addr.test (host)) {
    hostIP = host;
else {
    hostIP = dnsResolve(host);
if (isInNet(hostIP, "", "")) {
    return "DIRECT";
if (host == "localhost") {
    return "DIRECT";
return "PROXY";


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

Thanks in advance


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.