16

Say I want to use a proxy auto-config file that is stored at C:\proxy.pac. To make Internet Explorer use this configuration I have to specify the pac-file in the LAN settings in the following way:

file://C:/proxy.pac

But Safari, that uses the same proxy settings, will ignore it in this case. To make Safari use the pac-file I have to reference it as

file:///C:/proxy.pac

(3 slashes at the beginning) which, according to Wikipedia is the correct format. But this way Internet Explorer will ignore it. Opera and Chrome, that also use the same proxy settings, are fine with both ways but is there another option that will work with Safari and Internet Explorer at the same time?

1
  • I use a GitHub Gist as my proxy configuration file. (I know this is not "local", which is why I post this as a comment, not an answer.)
    – bers
    May 11, 2022 at 7:50

5 Answers 5

7

For IE and the windows platform, the correct location for a local pac file seems to be:

file://C:/Windows/system32/drivers/etc/proxy

next to your hosts file.

1
  • 4
    please note there is no extension
    – j040p3d20
    Feb 13, 2011 at 12:48
6

This feature is no longer supported in W8.1 since the file:// schema was never supported by WinHTTP. So tools that use WinHTTP for proxy settings will not recognize it.

Also note:

In November 2012, the .NET Framework was changed to use WinHTTP for PAC processing, which means that, by default, .NET Applications will not support file://-based proxy scripts any longer either.

If you want to enable the file protocol for later version than IE10 you can always use the following registry setting:

  • Key: HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\
  • Value: EnableLegacyAutoProxyFeatures
  • Type: REG_DWORD
  • Data: 1

See section "NOTE: File://-based Proxy Scripts Deprecated" here.

1
4

What happens if you use the dot, as Wikipedia also discusses: file://./C:/proxy.pac? So long as it is not on a sharename, this "spelling" of the path might be acceptable to both IE and Safari.

Alternatively, run a local webserver and serve the .pac file, then provide the URL as http://localhost/path/to/proxy.pac. That should work around the differences in path URL formats by avoiding using a path URL entirely.

3

On Windows 10, IE/Edge do not support reading a PAC file defined through the file:// syntax, even with EnableLegacyAutoProxyFeatures turned on:

This issue occurs because Internet Explorer and Edge on Windows 10-based computers use the WinHttp proxy service to retrieve proxy server information. The WinHttp Proxy service does not support using the ftp:// or file:// protocol for a PAC file. (https://support.microsoft.com/help/4025058/)

Since the same is true for .NET applications (https://superuser.com/a/826013/253137 and https://blogs.msdn.microsoft.com/ieinternals/2013/10/11/understanding-web-proxy-configuration/), the range of application you can target with file:// syntax is rather slim.

0

If you have a local webserver running, you can deliver the local pac file through that webserver.

I.e. for IIS:

  • Place the file here: C:\inetpub\wwwroot\proxy.pac
  • Add a mime type for .pac using IIS manager:
    .pac -> application/x-ns-proxy-autoconfig
    enter image description here
  • Reference the PAC file in your proxy settings as:
    http://localhost/proxy.pac

You must log in to answer this question.

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