12

On older systems such as Windows 7 + IE10, calling "alert()" in the PAC file would cause a dialog being shown. However, with Windows 8.1 no dialogs are displayed even if IE11 seems to be making use the PAC.

My current situation is IE11 can use the (SOCKS) proxies (returned by the PAC) just fine, but Modern UI apps are completely disconnected from Internet. It seems IE11 and Modern UI treat the PAC setting differently but I cannot find a way to debug it.

In summary, my questions are

  1. How can I debug the PAC with IE11 on Windows 8.1?
  2. How can I debug the PAC with Modern UI on Windows 8.1?
2
  • 1
    I've ran into the same issue - neither Firefox, Chrome or IE seem to be picking up alert calls. I've used utmtools.com/PacMagic and code.google.com/p/pacparser for 'testing' purposes.
    – oviava
    Mar 18, 2015 at 16:28
  • +1 for PacMagic. The generator could use some tweaks, but the testing feature works great. And it's just one standalone exe file.
    – Neil
    Nov 6, 2015 at 5:18

2 Answers 2

5

IE11 PAC-file changes

There were changes made by Microsoft to how IE11 handles local PAC files. You can read about them here or see below for some quick info.

Also note, that alert() statements no longer work as of Windows 8.


With IE11, the usage of a PAC-file through the file-protocol is no more possible, unless you add the following registry-key:

[HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings]
(DWORD)"EnableLegacyAutoProxyFeatures"=1

PAC-file through file-protocol example

Note: alert-statements will no more appear when using Windows 8 or higher!


DEBUG PAC File with AUTOPROX (Download Link)

Sometimes you need just to test your PAC-file, if the expected route is returned, although you have no access to the website in question. For such testing you can use the (attached) command line-utility tool autoprox.exe, created by Pierre-Louis Coll.

When starting it in a CMD without additional parameter the usage is displayed:

C:\temp>autoprox
Version : 2.1.0.0
Written by [email protected]
Usage : AUTOPROX -s  (calling DetectAutoProxyUrl and saving wpad.dat file in temporary file)
Usage : AUTOPROX  [-h] url [Path to autoproxy file]
       -h: calls InternetInitializeAutoProxyDll with helper functions implemented in AUTOPROX
AUTOPROX url: calling DetectAutoProxyUrl and using WPAD.DAT logic to find the proxy for the url
AUTOPROX url path: using the autoproxy file from the path to find proxy for the url
Example: autoprox -s
Example: autoprox http://www.microsoft.com
Example: autoprox -h http://www.microsoft.com c:\inetpub\wwwroot\wpad.dat
Example: autoprox http://www.microsoft.com http://proxy/wpad.dat

Here is the output with our sample:

C:\temp>autoprox http://us.msn.com c:\temp\sample.pac
The Winsock 2.2 dll was found okay
url: http://us.msn.com
autoproxy file path is : c:\temp\sample.pac
Calling InternetInitializeAutoProxyDll with c:\temp\sample.pac
        Calling InternetGetProxyInfo with url http://us.msn.com and host us.msn.com
        Proxy returned for url http://us.msn.com is:
PROXY myproxy:80;

When you want to see which DNS-related functions have been called, you can use the parameter “-h” in addition: Here the output, when this is used:

C:\temp>autoprox -h http://us.msn.com c:\temp\sample.pac
The Winsock 2.2 dll was found okay
Will call InternetInitializeAutoProxyDll with helper functions
url: http://us.msn.com
autoproxy file path is : c:\temp\sample.pac
Calling InternetInitializeAutoProxyDll with c:\temp\sample.pac
        Calling InternetGetProxyInfo with url http://us.msn.com and host us.msn.com
ResolveHostByName called with lpszHostName: us.msn.com
ResolveHostByName returning lpszIPAddress: 65.55.206.229
        Proxy returned for url http://us.msn.com is:
PROXY myproxy:80;

Error-Handling in autoprox.exe:

  1. When you specify a non-existing PAC-file (e.g. typo in the command-line), the result from autoprox.exe will be:

    ERROR: InternetInitializeAutoProxyDll failed with error number 0x6 6.

  2. When the Pac-file contains syntax-errors, you typically receive the following message displayed:

    ERROR: InternetGetProxyInfo failed with error number 0x3eb 1003.

After finishing the local test, the PAC-file should be copied to the webserver where it will be accessed through http-protocol.

1
  • Note: Error 0x3eb also happens when array access is out-of-bounds for example. Notably Windows <1809 has issues with arrays written like [1,2,3,] (note the trailing comma) for which you get length=4 (duh) Also noteworthy is the fact that autoprox seems to cache the pac file even though it looks like it is downloading a new one each time.
    – Marki
    Nov 26, 2020 at 11:38
0

There's a tool pactester that comes as part of pacparser, that was mentioned in the comments by @oviava, which works on Windows and Unix-based systems including Linux (e.g. sudo apt install libpacparser1) and MacOS (e.g. brew install pacparser). This can be used to test PAC files - it will show the expected behaviour for that URL or will report any errors with the PAC file. e.g.

pactester -p your_pac_file.pac -u http://www.test_site.com 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .