ShExpMatch and Internet Explorer 6 in a proxy.pac

internet explorerPROXYproxy.pacwpad.dat

I'm trying to setup a proxy.pac file that may be used for IE6 clients. This is basically it:

function FindProxyForURL(url, host) {
    if (shExpMatch(host, "*example.com*")) return "DIRECT";

    return "PROXY 1.2.3.4:8080";
}

This file tells the browser that any client trying to go to a host matching "*example.com*" should use a direct connection, otherwise use the proxy.

This works fine in essentially any browser, but IE6 never matches the shExpMatch no matter what I try. I've read this and disabled the cache as described here, but to no avail.

I'm positive IE6 supports the shExpMatch function, but if someone wants to correct me, I'd be glad to hear it. Incidentally, this is running on WinXP SP2.

Best Answer

Here's a slightly modified WPAD.DAT I'm using at a Customer site. It's working fine on IE6, unmodified... (because they won't give me the go-ahead to upgrade to IE8). The only modifications I put in were to obscure the Customer's domain names.

function FindProxyForURL(url, host) {

  if ( isPlainHostName(host) ) { return "DIRECT"; }

  if ( shExpMatch(url, "https:*") ) { return "DIRECT"; }

  if ( shExpMatch(url,"http://*.customer.domain.com")) { return "DIRECT"; }

  if ( isInNet(host,"127.0.0.1", "255.255.255.255") ) { return "DIRECT"; }

  if ( isInNet(host,"10.35.0.0", "255.255.0.0") ) { return "DIRECT"; }

  if ( isInNet(host,"192.168.0.0", "255.255.0.0") ) { return "DIRECT"; }

  return "PROXY proxy.customer.domain.com:8080";
}

The only difference that I see is that you're not matching "http:" at the beginning, but that shouldn't matter.

You're not supposed to do it, but you can put alert() statements in and IE6 will display them. You may be able to get some traction in debugging by doing that.