How to disable automatic proxy caching in Internet Explorer

Summary
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; PROXY mybackupproxy:80";}
  • Configure Internet Explorer to use this PAC file.
  • Start Internet Explorer and type the following Web address:
    http://webserver/login
    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 one of the returned proxies.
More information
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.

If an automatic proxy configuration script is configured to be used and Internet Explorer is able to retrieve it from the network (either if the Automatically Detect Settings option or the Use automatic configuration script are enabled), the Automatic Proxy Result Cache is updated with the hostname being accessed and the complete set of proxy servers returned by parsing the script. In the example, any hostname that is determined to use a proxy server will have "PROXY myproxy:80; PROXY mybackupproxy:80" added to the Automatic Proxy Result Cache.

In this scenario, “myproxy” is used for any subsequent access to a cached hostname and the automatic proxy configuration script is not re-processed. If “myproxy” is suddenly inaccessible, the following happens:

  • The “myproxy” proxy is added to the list of bad proxy servers.
  • The “mybackupproxy” proxy is selected to serve the request for the hostname in question, taken from the Automatic Proxy Result Cache.
  • If the connection is successful, “mybackupproxy” is used in subsequent requests to this hostname during the same browsing session.
If all of the proxy servers returned from the automatic proxy configuration script are inaccessible, then you receive a "Page Cannot Be Displayed" error message in Internet Explorer (which would happen if a static proxy server is suddenly inaccessible).

This allows proxy failover to still occur even if the Automatic Proxy Result Cache is enabled but it does not allow you to specify a different proxy server for the same hostname but, for instances, for different URL’s, as illustrated in the example. If this is a requirement, then you may want to disable the Automatic Proxy Result Cache feature. 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 registry

Important 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:
322756 How to back up and restore the registry in Windows


You can disable the Automatic Proxy Result Cache by using the following registry key:
HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings


Value: EnableAutoproxyResultCache
Type: REG_DWORD
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

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\CurrentVersion\Internet Settings]"EnableAutoProxyResultCache"=dword:00000000"

Method 2: Modify Group Policy settings

  1. Click Start, click Run, type gpedit.msc, and then click OK.
  2. In Group Policy Object Editor, double-click User Configuration\Administrative Templates\Windows Components\Internet Explorer.
  3. Double-click Disable caching of Auto-Proxy scripts.
  4. 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:
320507 Internet Explorer does not retry bad proxy server for 30 minutes
pac autoconfiguration autoproxy shExpMatch
Properties

Article ID: 271361 - Last Review: 03/11/2016 08:36:00 - Revision: 13.0

Internet Explorer 11, Internet Explorer 10, Windows Internet Explorer 9, Windows Internet Explorer 8, Windows 7 Enterprise, Windows 7 Enterprise N, Windows 7 Home Basic, Windows 7 Home Premium, Windows 7 Home Premium N, Windows 7 Professional, Windows 7 Professional N, Windows 7 Starter, Windows 7 Starter N, Windows 7 Ultimate, Windows 7 Ultimate N, Microsoft Internet Explorer 6.0, Windows Internet Explorer 7

  • kbenv kbhowto KB271361
Feedback