Recently we receive some reports that Lync 2013 and Skype for Business 2015/2016 clients were trying to use a Proxy Server for lyncdiscover and lyncdiscoverinternal URLs when the Proxy was configured using a Proxy PAC script.
During discovery process the Lync/SfB client will check the Proxy PAC file with the following URLs:
http://lyncdiscoverinternal.gears.lab?sipuri=baird@gears.lab
https://lyncdiscoverinternal.gears.lab?sipuri=baird@gears.lab
http://lyncdiscover.gears.lab?sipuri=baird@gears.lab
https://lyncdiscover.gears.lab?sipuri=baird@gears.lab
For reference, here is a copy of my Proxy PAC file:
function FindProxyForURL(url, host) { /* Proxy all other hosts in gears.lab domain */ if ((shExpMatch(host, "*.gears.lab"))) { return "DIRECT";} else { return "PROXY proxy.comm.lab:8080";} }
We would expect that the following condition would cover the discovery URLs:
shExpMatch(host, “*.gears.lab”)
But it won’t, because the host variable will be:
lyncdiscover.gears.lab?sipuri=baird@gears.lab
So why we don’t get the right value in the host variable?
To answer this we will use PAC Magic from UTM Tools:
UTM Tools – PacMagic
http://utmtools.com/PacMagic
In the first test we use one of the discovery URLs that the Lync/SfB client uses:
In the second test we add a “/” after the domain:
As we can see now we get the right result, so the reason behind the wrong host value is the missing “/”.
Now with the help of PAC Magic we can test a few workarounds. Please note that there are more but these will work just fine:
1) Using the URL
This will match all the discovery URLs:
if ((shExpMatch(url, “http*://lyncdiscover*.gears.lab*”))) { return “DIRECT”;}
2) Using Host
Similar to the first we can use the host variable:
if ((shExpMatch(host, “lyncdiscover*.gears.lab*”))) { return “DIRECT”;}
3) Using URL and Substring
This is workaround requires that you check the length of each URL but is also a valid alternative:
if (url.substring(0,29) == “http://lyncdiscover.gears.lab”) {return “DIRECT”;}
if (url.substring(0,30) == “https://lyncdiscover.gears.lab”) {return “DIRECT”;}
if (url.substring(0,37) == “http://lyncdiscoverinternal.gears.lab”) {return “DIRECT”;}
if (url.substring(0,38) == “https://lyncdiscoverinternal.gears.lab”) {return “DIRECT”;}