When you configure Internet Explorer to use an automatic proxy configuration script, it caches the proxy that is returned by the FindProxyForURL
call. The caching mechanism (Automatic Proxy Result Cache) is performed on a host basis (that is, not on an URL basis). This prevents you from using different proxies to gain access to the same Web server. The following sample scenario demonstrates this behavior:
- Configure a Web server that is named "Webserver" with two virtual folders: "/login" and "/test".
- Create the following .pac file:
function FindProxyForURL (url, host)
if shExpMatch (url, "http://webserver/login") return "DIRECT";
else return "PROXY myproxy:80";
- Configure Internet Explorer to use this .pac file.
- Start Internet Explorer and type the following Web address:
Internet Explorer loads the .pac file and correctly uses a direct connection.
- When the logon page appears, type http://webserver/test.
If you use Network Monitor, you can observe that access to "http://webserver/test" still uses a direct connection instead of "myproxy".
The Automatic Proxy Result Cache is a performance enhancement that was added to Internet Explorer 5.5 and later. The purpose of the cache is to reduce the client-side processing of the automatic proxy configuration script. When you connect to an Internet site, the FindProxyForURL
function is used to determine whether a proxy should be used and which proxy
to use. Internet Explorer 5.5 and later first checks the Automatic Proxy Result Cache to determine whether a proxy was used to connect to the host on previous attempts. If this checks fails, it indicates that this is the first attempt to connect to the host during the current session and the normal proxy detection logic applies. The following list illustrates the logic Internet Explorer 5.5 and later uses to determine whether a proxy should be used and which proxy
- If Automatically Detect Settings is turned on in Internet Explorer, an attempt is made to download the Wpad.dat file from the local area network (LAN) and process it as an automatic proxy configuration script. If a proxy is returned from the script and Internet Explorer has established a connection through the proxy, the Automatic Proxy Result Cache is updated with the host and the proxy server name that was returned.
- If Use automatic configuration script is turned on in Internet Explorer,
the automatic proxy configuration script is downloaded and processed. If a proxy is returned from the script and Internet Explorer has established a connection through the proxy, the Automatic Proxy Result Cache is updated with the host and the proxy server name that was returned.
- If Internet Explorer is configured for a static proxy
server, the proxy server name is retrieved from the registry.
When Internet Explorer uses an automatic proxy configuration script, a connection is opened with the proxy server if the processing of the script indicates that a proxy is to be used. If the proxy server cannot establish a connection, the proxy server name is added to a link list of bad proxy servers so that it is not used for 30 minutes. If the automatic proxy configuration script contains a PROXY return that lists multiple proxy servers, the next proxy in the list is attempted until the list is traversed or a connection is established. If the list is traversed and no connection has been established, you receive a "Page Cannot Be Displayed" error message in Internet Explorer.
When a connection is established through a proxy server, the host name of the site and the proxy server name are cached. On future attempts to access the host name in the same session, Internet Explorer has cached information about which proxy to use. Therefore, all subsequent connections to the host are tried through the proxy that was used previously. This means that if the proxy server name that is cached is unavailable during the same session, the automatic proxy configuration script is not re-processed, and you receive a "Page Cannot Be Displayed" error message in Internet Explorer.
You may want to disable the Automatic Proxy Result Cache to provide the proxy redundancy that you require. This will result in client-side processing of every GET request that is issued by Internet Explorer. As a result, Internet Explorer performance may be impacted depending on the logic of the Automatic Proxy Configuration Script and its size. To disable the Automatic Proxy Result Cache, use one of the following methods.Note
If you disable automatic proxy caching, Internet Explorer performance may be affected.
Method 1: Modify the registryImportant
This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
How to back up and restore the registry in Windows
You can disable the Automatic Proxy Result Cache by using the following registry key:
Data value: 0 = disable caching; 1 (or key not present) = enable automatic proxy caching (this is the default behavior)
If the registry key is not present, you can create the registry key by using the following registry file:
Windows Registry Editor Version 5.00
Method 2: Modify Group Policy settings
- Click Start, click Run, type gpedit.msc, and then click OK.
- In Group Policy Object Editor, double-click User Configuration\Administrative Templates\Windows Components\Internet Explorer.
- Double-click Disable caching of Auto-Proxy scripts.
- Click Enable, and then click OK.
You may have to use this registry key if you connect by using a proxy server that is handling secure and non-secure requests on the same server. One example of this behavior is the SQUID Proxy Server software. Because Internet Explorer typically caches port information, it may not send a secure request over the correct port number when it tries to send secure and non-secure responses to the same server, but on different port numbers.
For more information about the addition of the bad proxy server list, click the following article number to view the article in the Microsoft Knowledge Base:
Internet Explorer does not retry bad proxy server for 30 minutes