cmpwat Posted March 27, 2014 Posted March 27, 2014 Morning all.... I know i am flogging a dead horse here but..... I am trying to configure wPAD on the network and I have a feeling that my dat file is wrong. I have configured DHCP 252 to look at http://wpad.my.domain/wpad.dat. I have setup DNS to the web server for wpad. I have run the dnscmd /config /enableglobalqueryblocklist 0 on all 3 DNS servers and I have put the dat file in the c:\inetpub\wwwroot folder of my web server. the contents of my dat file are: function FindProxyForURL(url, host){ var proxy_no = "DIRECT"; if (shExpMatch(url, "http://helpdeskserver/*")) { return proxy_no; } if (shExpMatch(url, "http://helpdeskserver")) { return proxy_no; } if (host == "fqdn of webfilter") { return proxy_no; } if (isInNet(myIpAddress(), "10.107.0.0", "255.255.248.0")) { return "PROXY proxy.swgfl.org.uk:8080" }; } I have set IE to automatically detect but still nothing, will not detect. I have run netsh winsock reset and rebooted and still nothing.... Now, if there anything wrong with the dat file? with it only work with domain joined machines? any help would be gratefully received!
AngryTechnician Posted March 27, 2014 Posted March 27, 2014 Have you configured the MIME type for .dat on the server hosting the wpad.dat? I don't think IIS will serve the file without it. It should be application/x-ns-proxy-autoconfig or application/x-javascript-config (I used the former)
cmpwat Posted March 27, 2014 Author Posted March 27, 2014 Thanks AngryTech I have put the MIME in, using the same as you: application/x-ns-proxy-autoconfig
AngryTechnician Posted March 27, 2014 Posted March 27, 2014 Does it work if you put the URL of the WPAD in manually using the "Use automatic configuration script" option? That would rule out a problem with loading and using the script, vs. a problem with the WPAD detection.
cmpwat Posted March 27, 2014 Author Posted March 27, 2014 all i get is the page could not be displayed...... this is what is making me think i have the content wrong.
soapyfish Posted March 27, 2014 Posted March 27, 2014 Are you able to ping the the wpad server using the DNS name...When I set things up I needed to create DNS entries for wpad wpad.internal wpad.domainname I needed to make sure that all 3 of these were "pingable" (if thats such a word) before I was able to get wpad to work as expected. Also are you using windows clients or a combination of windows and Apple devices ?
cmpwat Posted March 27, 2014 Author Posted March 27, 2014 Yeap, all pingable. I only have an internal domain, so both wpad and wpad.my.domain are pingable, with the right ip for the web server.
localzuk Posted March 27, 2014 Posted March 27, 2014 (edited) Is there a particular reason you need the "isInNet(myIpAddress()" bit? Can you try removing it, and just putting return "PROXY proxy.swgfl.org.uk:8080" at the end of the function before the }? In my experience, these bits are the ones that usually go wrong. Edited March 27, 2014 by localzuk
soapyfish Posted March 27, 2014 Posted March 27, 2014 (edited) In case its of any help this is the working wpad file that I am using, I have removed the specifics but it should make sense. ------------------------------------------------------------------------------------------------------------------------ function FindProxyForURL(url, host) { if (shExpMatch( host, "*INTERNAL IP ADDRESS RANGE*" ) || shExpMatch( host, "*INTERNAL IP ADDRESS RANGE*" ) || shExpMatch( host, "*INTERNAL IP ADDRESS RANGE*" ) || shExpMatch( host, "*INTERNAL IP ADDRESS RANGE*" ) || shExpMatch( host, "*INTERNAL IP ADDRESS RANGE*" ) || shExpMatch( host, "*INTERNAL IP ADDRESS RANGE*" ) || shExpMatch( host, "*INTERNAL IP ADDRESS RANGE*" ) || shExpMatch( host, "*INTERNAL IP ADDRESS RANGE*" ) || shExpMatch( host, "https://do not proxy this URL" ) || shExpMatch( host, "https://do not proxy this URL" ) || shExpMatch( host, "https://do not proxy this URL" ) || shExpMatch( host, "127.*" ) || shExpMatch( host, "localhost" ) || shExpMatch( host, "*192.168.3.*" ) || isPlainHostName( host ) || dnsDomainIs( host, ".example.com" )) { return "DIRECT"; } return "PROXY HOSTNAME:PORT; DIRECT"; } Edited March 27, 2014 by soapyfish
cmpwat Posted March 27, 2014 Author Posted March 27, 2014 No reason, just what was in all the samples I have looked at. I have reomved it and it still doesnt work.
localzuk Posted March 27, 2014 Posted March 27, 2014 So your new one looks like this now? [color=#333333]function FindProxyForURL(url, host){[/color] [color=#333333]var proxy_no = "DIRECT";[/color] [color=#333333]if (shExpMatch(url, "http://helpdeskserver/*")) { return proxy_no; }[/color] [color=#333333]if (shExpMatch(url, "http://helpdeskserver")) { return proxy_no; }[/color] [color=#333333]if (host == "fqdn of webfilter") { return proxy_no; }[/color] [color=#333333]return "PROXY proxy.swgfl.org.uk:8080"; [/color] [color=#333333]}[/color]
cmpwat Posted March 27, 2014 Author Posted March 27, 2014 Yeap, and the wpad is configured in DHCP and DNS and is all pingable etc......if i had hair, be tearing it out about now!
localzuk Posted March 27, 2014 Posted March 27, 2014 Can you get to the wpad address in a web browser? ie. go to wpad.domain.name/wpad.dat and download the file manually?
soapyfish Posted March 27, 2014 Posted March 27, 2014 Have you restarted IIS, I know its sounds obvious but I caught me out !
cmpwat Posted March 27, 2014 Author Posted March 27, 2014 Yeap, done that one too. I have had a look and found an extra } that shouldnt have been in there and removed it. the wpad is working for my Surface (win8.1) my iPad and iPhone but not on PCs. Also, I need to add a line the ignore local servers as I cannot get on PaperCut for example.
eshaq786 Posted March 28, 2014 Posted March 28, 2014 This is what I have and it works: function FindProxyForURL(url, host) { if (isInNet(myIpAddress(), "10.0.0.0", "255.0.0.0")) { if (shExpMatch(host,"10.*") || shExpMatch(host,"*.myvle.org") || shExpMatch(host,"pceconsole.bham.org.uk") || shExpMatch(host,"pceconsole2.bham.org.uk") || shExpMatch(host,"*.misportal.net") || shExpMatch(host,"*.bgfl.org") || shExpMatch(host,"*.bgfl.eu")) { return "DIRECT"; } else { return "PROXY eduproxy.bgfl.org:80"; } } else { return "DIRECT"; } } The reason its more complicated than normal is that I need it to work for laptops and PCs on and off site.
chazzy2501 Posted March 28, 2014 Posted March 28, 2014 This is the wpad from my isa server: //Copyright (c) 1997-2006 Microsoft Corporation BackupRoute="DIRECT"; UseDirectForLocal=true; function MakeIPs(){ } DirectIPs=new MakeIPs(); cDirectIPs=0; function MakeCARPExceptions(){ } CARPExceptions=new MakeCARPExceptions(); cCARPExceptions=0; function MakeNames(){ this[0]="dcc-sch.4505.local"; } DirectNames=new MakeNames(); cDirectNames=1; HttpPort="8080"; cNodes=1; function MakeProxies(){ this[0]=new Node("ISA.DCC-SCH-4505.local",0,1.000000); } Proxies = new MakeProxies(); function Node(name, hash, load){ this.name = name; this.hash = hash; this.load = load; this.score = 0; return this; } function FindProxyForURL(url, host){ var hash=0, urllower, i, fIp=false, ip, nocarp=false, skiphost=false; var list="", pl, j, score, ibest, bestscore; urllower = url.toLowerCase(); if((urllower.substring(0,5)=="rtsp:") || (urllower.substring(0,6)=="rtspt:") || (urllower.substring(0,6)=="rtspu:") || (urllower.substring(0,4)=="mms:") || (urllower.substring(0,5)=="mmst:") || (urllower.substring(0,5)=="mmsu:")) return "DIRECT"; if(UseDirectForLocal){ if(isPlainHostName(host)) fIp = true;} for(i=0; i if(shExpMatch(host, DirectNames[i])){ fIp = true; break;} if(shExpMatch(url, DirectNames[i])) return "DIRECT"; } if(cDirectIPs == 0){ if(fIp) return "DIRECT";} else{ ip = host; if(fIp) ip = dnsResolve(host); var isIpAddr = /^(\d+.){3}\d+$/; if(isIpAddr.test(ip)){ for(i=0; i if(isInNet(ip, DirectIPs[i], DirectIPs[i+1])) return "DIRECT";}} else if(isPlainHostName(host)) return "DIRECT"; } if(cCARPExceptions > 0){ for(i = 0; i < cCARPExceptions; i++){ if(shExpMatch(host, CARPExceptions[i])){ nocarp = true;} if(shExpMatch(url, CARPExceptions[i])){ nocarp = true; skiphost = true; break; }}} if(!skiphost) hash = HashString(host,hash); if(nocarp) hash = HashString(myIpAddress(), hash); pl = new Array(); for(i = 0; i Proxies[i].score = Proxies[i].load * Scramble(hash ^ Proxies[i].hash); pl[i] = i; } for(j = 0; j < cNodes; j++){ bestscore = -1; for(i = 0; i < cNodes-j; i++){ score = Proxies[pl[i]].score; if(score > bestscore){ bestscore = score; ibest = i; }} list = list + "PROXY " + Proxies[pl[ibest]].name + ":" + HttpPort + "; "; pl[ibest] = pl[cNodes-j-1]; } list = list + BackupRoute; return list; } var h_tbl = new Array(0,0x10D01913,0x21A03226,0x31702B35,0x4340644C,0x53907D5F,0x62E0566A,0x72304F79,0x8680C898,0x9650D18B,0xA720FABE,0xB7F0E3AD,0xC5C0ACD4,0xD510B5C7,0xE4609EF2,0xF4B087E1); function HashString(str, h){ for(var i=0; i var c = str.charAt(i); if(c ==':' || c == '/') break; c = CharToAscii(c.toLowerCase()); h = (h >>> 4) ^ h_tbl[(h ^ c) & 15]; h = (h >>> 4) ^ h_tbl[(h ^ (c>>>4)) & 15]; h = MakeInt(h); } return h; } function Scramble(h){ h += ((h & 0xffff) * 0x1965) + ((((h >> 16) & 0xffff) * 0x1965) << 16) + (((h & 0xffff) * 0x6253) << 16); h = MakeInt(h); h += (((h & 0x7ff) << 21) | ((h >> 11) & 0x1fffff)); return MakeInt(h); } var Chars =" !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~€???????????Ž????????????ž?¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþ "; function CharToAscii(c){ return Chars.indexOf(c) + 32; } function MakeInt(x){ x %= 4294967296; if(x < 0) x += 4294967296; return x; } it seems to cover everything! Adjust as needed:)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now