Sophos Web Appliance: Creating, Testing, and Deploying a proxy.pac File

  • Article ID: 38783
  • Rating:
  • 7 customers rated this article 3.7 out of 6
  • Updated: 04 Jun 2012

Proxy auto-configuration files (proxy.pac) are used to configure browsers when users select the "configuration from a file option" for proxy configuration. They contain web proxy information in the form of a few simple lines of JavaScript.

Create and test the proxy.pac file

  1. Using a basic text editor, such as Notepad, create a file with the following content:

    function FindProxyForURL(url, host) {
    return "PROXY;
  2. Change host and domain name of the web proxy (the "" part) to match the Web Appliance's configuration in your network. This script, when automatically accessed by your users' browsers, configures the browsers to use the Web Appliance as their web proxy and, if it can't connect, falls back to a direct connection to the internet.
  3. Save this file as proxy.pac.
  4. Test the file by choosing the "configuration from a file" option in the "connect to the internet using a web proxy" page, using a web browser currently configured to connect directly to the internet. To access this option:
    • In Internet Explorer, select Tools|Internet Options|Connections|LAN Settings: Use automatic configuration script
    • In Firefox, select Tools|Options|Advanced|Network|Connection Settings: Automatic proxy configuration URL
  5. Deploy the tested proxy.pac file to your users by any one of the following methods:
    1. Distribute the tested proxy.pac file either by emailing it to your users or by posting it on an internal web server.

      Note: If you post the proxy.pac file on an internal web server, the link to it will be displayed as a text file unless you set the MIME type in your web server configuration:
      • For Apache 1.x, edit your /etc/apache/httpd.conf file by adding the following line:
        AddType application/x-javascript-config pac
        Then restart the Apache web server.
      • For Apache 2.x, edit your /etc/apache2/mods-available/mime.conf file by adding the following line:
        AddType application/x-javascript-config pac
        Then restart the Apache web server.
      • For IIS:
        1. In IIS Manager, right-click the website or website directory for which you want to add a MIME type, and click Properties.
        2. Click the HTTP Headers tab.
        3. Click Mime Types.
        4. Click New.
        5. In the Extension box, enter the file name extension: pac.
        6. In the MIME type box, enter the MIME type description: application/x-javascript-config.
        7. Click OK,  and restart the IIS service.

      This option (a., using a proxy.pac file) requires the most work for users in your network.

    2. Distribute the configuration as a wpad.dat file, which is documented in the Publishing Proxy Information as a wpad.dat File Knowledgebase article.

      This method lets you maintain more control over the proxy configuration process. The "automatic proxy configuration" option is the default option, so your users don't have to do anything to configure their browsers to use the Web Appliance as their web proxy as long as they have not changed this option.
    3. Enforce the proxy configuration by Creating a Group Policy Object (GPO) on your Active Directory server.

      This requires that you have an Active Directory server, but it allows you to enforce your users' browser configuration to use the Web Appliance.

Support for problems with third-party products that this article discusses may be provided by the manufacturer of that product. Sophos does not support such third-party products. The third-party products that this article discusses are manufactured by companies that are independent of Sophos. Sophos makes no warranty, implied or otherwise, about the performance or reliability of these products.

If you need more information or guidance, then please contact technical support.

Rate this article

Very poor Excellent