Oracle iPlanet Web Proxy Server 4.0.14 Administration Guide

Example 7: Proxying a Specific Protocol

You can set a proxy for a specific protocol. Most of the standard JavaScript functionality is available for use in the FindProxyForURL()() function. For example, to set different proxies based on the protocol, you can use the substring()() function.

    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 if (url.substring(0, 7) == "gopher:") {
            return "PROXY gopher-proxy.mydomain.com:8080";
        }
        else if         (url.substring(0, 6) == "https:" ||
                url.substring(0, 6) == "snews:") {
            return "PROXY security-proxy.mydomain.com:8080";
        }
        else {
            return "DIRECT";
        }
    }

You can also accomplish this configuration by using the shExpMatch()() function; for example:

    ...
    if (shExpMatch(url, "http:*")) {
        return "PROXY http-proxy.mydomain.com:8080;
    }
    ...