Apache::ProxyConf is a Perl module that can generate proxy configuration for browsers.
# In httpd.conf:
< Location / >
PerlSetVar ProxyConfConfig "/some/location/proxyconf.ini"
< /Location >
The Apache::ProxyConf is used to configure the proxy settings in browsers automatically. The modules returns a script that conforms to the Navigator Proxy Auto-Config File Format. The module is suitable for large scale installations that have multiple (cascading) proxies. It can be used to return 'the closest proxy' based on the network topology. Failover and load distribution is also provided.
The (virtual) webserver must be entered in the 'Autoconfigure URL' of the browser to make use of the ProxyConf script.
In IE the URL must be specified in the 'Address' field, just below the 'Use automatic configuration script' tickbox.
THE CONFIGURATION FILE
The ProxyConf module first reads a .ini-style configuration file to determine the proxy settings of the network. The configuration file contains three sections: proxy, noproxy and https.
The proxy section
The sections proxy and https have an identical format. They contain lines of the form subnet=proxyip:port.
The subnet 172.16.32.0/20 has a single proxy defined. The proxy server is 172.16.32.10 and it listens on port 3128.
Multiple proxy servers are defined in a comma separated list. In this example clients in the 172.16.0.0/20 subnet use 172.16.0.10 as their primary proxy server. When this server becomes unavailable, the clients will move over to 172.16.0.20 for their proxy requests.
Multiple proxies with load distribution
When proxy servers are placed between brackets, the load is distribution amongst the proxies. Some clients will have the first proxy as primary and some clients will have the second proxy as primary. The other proxy is used as a backup. The order in which the proxies are tried depends on the IP address of the client. The script is deterministic, so for a given IP address the priority list is always the same.
To determine the proxy list for a given IP address multiple rules may be applied. Subnets are tried from the highest to the lowest mask. The module puts all proxies that are found in a list.
The noproxy section
The noproxy section contains hosts that should be contacted by the clients directly. Noticeably, web servers that use NTLM authentication will not work when clients connect to them via a proxy server. The syntax for specifying noproxy hosts is subnet=fqhn1,fqhn2,... Alternatively, the multiline syntax can be used, as shown in this example.