proxy.pac (Special file)

This is a special file containing rules for accessing sites through proxy servers.

If you are using a browser inside a firewall, you will likely reach the internet by using a proxy server. This is a special kind of web server that spans or bridges the firewall and fetches things across the internet for you.

Generally these proxy servers will also limit access or log details of everything you fetch.

You can operate with no proxies, manually defined proxies, or automatic proxies in the case of Netscape Navigator.

When you select Automatic mode, you are connecting in to a piece of JavaScript code that can work out whether to use a proxy or not and if so, which one.

In this context, some language features may be unavailable but then others are provided to assist in the deconstruction of URL values, and are only available in this context.

The only purpose of a proxy.pac file is to define the content of the FindProxyForURL() function.

The proxy.pac file can be retrieved from any location that can be defined by a URL. This means it could be a local file on your desktop or served directly by a web server inside your firewall. In theory it could be served by a web server outside your firewall so long as your firewall had a 'hole' in it to allow you to gain direct access to the server. That could lead to problems where the file you pull back might thereafter prevent access to that location, and it obviates the whole purpose of having a firewall in the first place.

Providing this file on a local web server inside your firewall means that it can be shared by all your Netscape Navigator browser users and maintained from a central locations. This is not very much use if you only have one user but when you have 500 it is a great time saver. However, the downside is that if you publish a broken proxy.pac file, all of your users go offline as soon as their browsers download it.

You cannot browse a proxy.pac file with a Netscape Navigator browser; however, you might be able to download one with MSIE if you are curious to see what it looks like.

To set this mechanism working, you need to go to the proxy configuration panel in your browser preferences and choose automatic proxy configuration. Then you need to type in the URL where the proxy.pac file lives.

See also:.pac, File extensions, FindProxyForURL(), isInNet(), isPlainHostName(), Proxies


Wrox Instant JavaScript - page - 57