Principe

  • Le serveur DHCP distribue un nom de domaine par défaut.
  • Le serveur DNS dispose d'un enregistrement "wpad" qui pointe vers un serveur web. Un fichier "wpad.dat" doit être situé à la racine.
  • Les navigateurs sont configurés en "détection automatique des paramètres proxy".

Exemple de configuration

  • Un serveur DHCP est disponible à l'adresse 192.168.16.254
  • Un serveur DNS est disponible à l'adresse 192.168.16.1, ce serveur fait autorité pour le domaine local "foo.net"
  • Un serveur PROXY et WEB est disponible à l'adresse 192.168.16.16
  • Le DHCP doit  distribuer :
    • Le domain name : foo.net
    • Le DNS server : 192.168.16.1
  • Le DNS doit avoir un enregistrement dans le domaine foo.net :
    • wpad   192.168.16.16
  • Le fichier wpad.dat doit être copié à la racine du serveur web (sur la machine 192.168.16.16)

Exemple de fichier wpad.dat

function FindProxyForURL(url,host){
   var proxy_yes = "PROXY 192.168.16.16:8080";
   var proxy_no = "DIRECT";
   // No proxy for local

   if (isPlainHostName(host)){ return proxy_no; }
   if (shExpMatch(url, "http://127.*/*")){ return proxy_no; }
   if (shExpMatch(url, "https://127.*/*")){ return proxy_no; }
   if (shExpMatch(url, "http://127.*:*/*")){ return proxy_no; }
   if (shExpMatch(url, "https://127.*:*/*")){ return proxy_no; }
   if (shExpMatch(url, "http://localhost/*")){ return proxy_no; }
   if (shExpMatch(url, "https://localhost/*")){ return proxy_no; }
   if (shExpMatch(url, "http://localhost:*/*")){ return proxy_no; }
   if (shExpMatch(url, "https://localhost:*/*")){ return proxy_no; }
   if (shExpMatch(url, "http://*.foo.net/*")){ return proxy_no; }
   if (shExpMatch(url, "https://*.foo.net/*")){ return proxy_no; }
   if (shExpMatch(url, "http://*.foo.net:*/*")){ return proxy_no; }
   if (shExpMatch(url, "https://*.foo.net:*/*")){ return proxy_no; }
   if (shExpMatch(url, "http://192.168.16.*/*")){ return proxy_no; }
   if (shExpMatch(url, "https://192.168.16.*/*")){ return proxy_no; }
   if (shExpMatch(url, "http://192.168.16.*:*/*")){ return proxy_no; }
   if (shExpMatch(url, "https://192.168.16.*:*/*")){ return proxy_no; }
   // Proxy anything else
   return proxy_yes;
}