WPAD.dat /proxy.pac problem



  • Hello,
    I use Pfsense2.3.

    The configuration of my hardware is the following:
    A firewall departure: a LAN (WLAN 10.0.11.x not [wireless] 10.0.12.x) non transparent proxy (without authentication) is operational on 2 interfaces offices and a captive portal is Installed on the WLAN.

    I SINCE few days the following problem:
    When I configure Firefox in the manual mode on any WLAN Works well (captive portal authentication and proxy redirection)

    [Manual proxy configuration:
    HTTP proxy: 10.0.11.252 –------- Port: 8080


    |
    |
    |
    No proxy for:
    10.0.12.254:8002,]

    But not when I Initiation proxy.pac or wpad.dat with the Next line, nothing works:

    FindProxyForURL function (url, host)
    {
    if (shExpMatch (url, "10.0.12.254:8002/*"))
    {Return "DIRECT";}
    other
    {Return "PROXY 10.0.11.252:8080";}
    }

    This code is probably wrong I really struggle with wpad file despite the doc on the internet if anyone knows transcribe my manual config file or proxy.pac wpad and squeezed it nice.

    Thank you in advance for the help :)



  • This is a generic wpad that exempts all private address space

    function FindProxyForURL(url,host)
    {
    // If the requested website is hosted within the internal network, send direct.
        if (isPlainHostName(host) ||
            shExpMatch(host, "*.local") ||
            isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0") ||
            isInNet(dnsResolve(host), "172.16.0.0",  "255.240.0.0") ||
            isInNet(dnsResolve(host), "192.168.0.0",  "255.255.0.0") ||
            isInNet(dnsResolve(host), "127.0.0.0", "255.255.255.0"))
            return "DIRECT";
    // Else use the proxy
        return "PROXY 10.0.11.252:8080";
    }
    


  • Thank you for helping me :)
    Unfortunately this code, it doen't work I only accesses a page of my captive portal after authentification, I can't have access to the proxy (from wireshark).



  • I can assure you it works perfectly.  Perhaps you have a configuration issue or something else going on.



  • I believe you for the code, thank you again. I think the problem is in the redirection of the captive portal to proxy, according wireshark my connexion stay on 10.0.12.252 (wlan) and don't go to the proxy. I don't know why ? while the manual configuration of Firefox work :/



  • I've never used captive portal so I can't help you there.


Log in to reply