Client Proxy Settings

6.4 Client Proxy Settings

All modern web browsers let you configure the use of proxies. In fact, many browsers provide multiple ways of configuring proxies, including:

Manual configuration

You explicitly set a proxy to use.

Browser preconfiguration

The browser vendor or distributor manually preconfigures the proxy setting of the browser (or any other web client) before delivering it to customers.

Proxy auto-configuration (PAC)

You provide a URI to a JavaScript proxy auto-configuration (PAC) file; the client fetches the JavaScript file and runs it to decide if it should use a proxy and, if so, which proxy server to use.

WPAD proxy discovery

Some browsers support the Web Proxy Autodiscovery Protocol (WPAD), which automatically detects a "configuration server" from which the browser can download an auto-configuration file. [7]

[7] Currently supported only by Internet Explorer.

6.4.1 Client Proxy Configuration: Manual

Many web clients allow you to configure proxies manually. Both Netscape Navigator and Microsoft Internet Explorer have convenient support for proxy configuration.

In Netscape Navigator 6, you specify proxies through the menu selection Edit figs/u2192.gif Preferences figs/u2192.gif Advanced figs/u2192.gif Proxies and then selecting the "Manual proxy configuration" radio button.

In Microsoft Internet Explorer 5, you can manually specify proxies from the Tools figs/u2192.gif Internet Options menu, by selecting a connection, pressing "Settings," checking the "Use a proxy server" box, and clicking "Advanced."

Other browsers have different ways of making manual configuration changes, but the idea is the same: specifying the host and port for the proxy. Several ISPs ship customers preconfigured browsers, or customized operating systems, that redirect web traffic to proxy servers.

6.4.2 Client Proxy Configuration: PAC Files

Manual proxy configuration is simple but inflexible . You can specify only one proxy server for all content, and there is no support for failover. Manual proxy configuration also leads to administrative problems for large organizations. With a large base of configured browsers, it's difficult or impossible to reconfigure every browser if you need to make changes.

Proxy auto-configuration (PAC) files are a more dynamic solution for proxy configuration, because they are small JavaScript programs that compute proxy settings on the fly. Each time a document is accessed, a JavaScript function selects the proper proxy server.

To use PAC files, configure your browser with the URI of the JavaScript PAC file (configuration is similar to manual configuration, but you provide a URI in an "automatic configuration" box). The browser will fetch the PAC file from this URI and use the JavaScript logic to compute the proper proxy server for each access. PAC files typically have a .pac suffix and the MIME type "application/x-ns-proxy- autoconfig ."

Each PAC file must define a function called FindProxyForURL(url,host) that computes the proper proxy server to use for accessing the URI. The return value of the function can be any of the values in Table 6-1 .

Table 6-1. Proxy auto-configuration script return values

FindProxyForURL return value

Description

DIRECT

Connections should be made directly, without any proxies.

PROXY host:port

The specified proxy should be used.

SOCKS host:port

The specified SOCKS server should be used.

The PAC file in Example 6-1 mandates one proxy for HTTP transactions, another proxy for FTP transactions, and direct connections for all other kinds of transactions.

Example 6-1. Example proxy auto-configuration file
 function FindProxyForURL(url, host) { 
 if (url.substring(0,5) == "http:") { 
 return "PROXY http-proxy.mydomain.com:8080"; 
  } else if (url.substring(0,4) =="ftp:") {  
  return "PROXY ftp-proxy.mydomain.com:8080";  
  } else {  
  return "DIRECT";  
  }  
  }  

For more details about PAC files, refer to Chapter 20 .

6.4.3 Client Proxy Configuration: WPAD

Another mechanism for browser configuration is the Web Proxy Autodiscovery Protocol (WPAD). WPAD is an algorithm that uses an escalating strategy of discovery mechanisms to find the appropriate PAC file for the browser automatically. A client that implements the WPAD protocol will:

         Use WPAD to find the PAC URI.

         Fetch the PAC file given the URI.

         Execute the PAC file to determine the proxy server.

         Use the proxy server for requests .

WPAD uses a series of resource-discovery techniques to determine the proper PAC file. Multiple discovery techniques are used, because not all organizations can use all techniques. WPAD attempts each technique, one by one, until it succeeds.

The current WPAD specification defines the following techniques, in order:

         Dynamic Host Discovery Protocol (DHCP)

         Service Location Protocol (SLP)

         DNS well-known hostnames

         DNS SRV records

         DNS service URIs in TXT records

For more information, consult Chapter 20 .

 



HTTP. The Definitive Guide
HTTP: The Definitive Guide
ISBN: 1565925092
EAN: 2147483647
Year: 2001
Pages: 294

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net