Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    WPAD script for those in need (squid related)

    Scheduled Pinned Locked Moved pfSense Packages
    1 Posts 1 Posters 789 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      securityconscious
      last edited by

      Perhaps someone will need simple ease of access to this script for wpad.dat, wpad.da & proxy.pac (NOTE: same script used in ALL the files named and ALL placed on pfsense in the  usr/local/www directory). Needed for enabling autoconfig in browsers that is part of the process with squid.

      function FindProxyForURL(url, host)
      {
         if (isInNet(host, "10.10.0.0", "255.255.0.0")) {
            return "DIRECT";
         } else {
            if (shExpMatch(url, "http:*")) 
               return "PROXY 192.168.1.1:3128" ;
            if (shExpMatch(url, "https:*"))
               return "PROXY 192.168.1.1:3128" ;
            if (shExpMatch(url, "ftp:*"))
               return "PROXY 192.168.1.1:3128" ;
            return "DIRECT";
         }
      }
      

      Replace the 192.168.1.1 (if needed) to reflect your pfsense address.

      CHEERS

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.