Oracle iPlanet Web Proxy Server 4.0.14 Administration Guide

FindProxyForURL() Function

The syntax of the FindProxyFor() URL function is:

function FindProxyForURL(url, host){   ...}

For every URL the browser accesses, it sends the url and host parameters and calls the function in the following way:

ret = FindProxyForURL(url, host);

url is the full URL being accessed in the browser.

host is the host name extracted from the URL that is being accessed. This is only for convenience; it is the same string as between :// and the first : or / after that. The port number is not included in this parameter. It can be extracted from the URL when necessary.

ret (the return value) is a string describing the configuration.

Function Return Values

The autoconfiguration file contains the function FindProxyForURL(). This function uses the client host name and the URL it is accessing as parameters, . The function returns a single string that tells the browser how to proceed. If the string is null, no proxies should be used. The string can contain any number of the building blocks shown in the following table, separated by semicolons.

Table 17–2 FindProxyForURL() Return Values

Return Values  

Resulting Action of the Browser  

DIRECT

Make connections directly to the server without going through any proxies. 

PROXY host:port

Use the specified proxy and port number. If multiple values are separated by semicolons, the first proxy is used. If that proxy fails, then the next proxy is used, and so on. 

SOCKS host:port

Use the specified SOCKS server. If multiple values are separated by semicolons, the first proxy is used. If that proxy fails, then the next proxy is used, and so on. 

If the browser encounters an unavailable proxy server, the browser will automatically retry the previously unresponsive proxy after 30 minutes, then after one hour, and so on, at 30-minute intervals. So, if you temporarily shut down a proxy server, your clients will resume using the proxy no later than 30 minutes after it was restarted.

If all of the proxies are down and the DIRECT return value is not specified, the browser will ask the user whether the browser should temporarily ignore proxies and attempt direct connections instead. The browser will ask if proxies should be retried after 20 minutes, then again in another 20 minutes, and so on at 20-minute intervals.

In the following example, the return value tells the browser to use the proxy called w3proxy.example.com on port 8080. If that proxy is unavailable, the browser uses the proxy called proxy1.example.com on port 8080:

PROXY w3proxy.example.com:8080; PROXY proxy1.example.com:8080

In the next example, the primary proxy is w3proxy.example.com:8080. If that proxy is unavailable, the browser uses proxy1.example.com:8080. If both proxies are unavailable, then the browser goes directly to the server. After 20 minutes, the browser asks the user whether it should retry the first proxy.

PROXY w3proxy.example.com:8080; PROXY proxy1.example.com:8080; DIRECT