mod_proxy.html revision 25503838e438bb909e3ff880125732c7ed5e64ad
0N/A<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
0N/A<HTML>
0N/A<HEAD>
0N/A<TITLE>Apache module mod_proxy</TITLE>
0N/A</HEAD>
0N/A
0N/A<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
0N/A<BODY
0N/A BGCOLOR="#FFFFFF"
0N/A TEXT="#000000"
0N/A LINK="#0000FF"
0N/A VLINK="#000080"
0N/A ALINK="#FF0000"
0N/A>
0N/A<!--#include virtual="header.html" -->
0N/A<H1 ALIGN="CENTER">Apache module mod_proxy</H1>
0N/A
0N/AThis module is contained in the <CODE>mod_proxy.c</CODE> file for Apache 1.1.x,
0N/Aor the <CODE>modules/proxy</CODE> subdirectory for Apache 1.2, and
0N/Ais not compiled in by default. It provides for an <STRONG>HTTP
0N/A1.0</STRONG> caching proxy
0N/Aserver. It is only available in Apache 1.1 and later. Common configuration
0N/Aquestions are addressed <A HREF="#configs">after the directive
0N/Adescriptions</A>.
0N/A
0N/A<H3>Note:</H3>
0N/A<P>This module was experimental in Apache 1.1.x. As of Apache 1.2, mod_proxy
0N/Astability is <EM>greatly</EM> improved.<P>
0N/A
0N/A<H2>Summary</H2>
0N/A
0N/AThis module implements a proxy/cache for Apache. It implements
0N/Aproxying capability for
0N/A<CODE>FTP</CODE>,
0N/A<CODE>CONNECT</CODE> (for SSL),
0N/A<CODE>HTTP/0.9</CODE>, and
0N/A<CODE>HTTP/1.0</CODE>.
0N/AThe module can be configured to connect to other proxy modules for these
0N/Aand other protocols.
0N/A
0N/A<H2>Directives</H2>
0N/A<UL>
0N/A<LI><A HREF="#proxyrequests">ProxyRequests</A>
0N/A<LI><A HREF="#proxyremote">ProxyRemote</A>
0N/A<LI><A HREF="#proxypass">ProxyPass</A>
0N/A<LI><A HREF="#proxyblock">ProxyBlock</A>
0N/A<LI><A HREF="#noproxy">NoProxy</A>
0N/A<LI><A HREF="#proxydomain">ProxyDomain</A>
0N/A<LI><A HREF="#cacheroot">CacheRoot</A>
0N/A<LI><A HREF="#cachesize">CacheSize</A>
0N/A<LI><A HREF="#cachemaxexpire">CacheMaxExpire</A>
0N/A<LI><A HREF="#cachedefaultexpire">CacheDefaultExpire</A>
0N/A<LI><A HREF="#cachelastmodifiedfactor">CacheLastModifiedFactor</A>
0N/A<LI><A HREF="#cachegcinterval">CacheGcInterval</A>
0N/A<LI><A HREF="#cachedirlevels">CacheDirLevels</A>
0N/A<LI><A HREF="#cachedirlength">CacheDirLength</A>
0N/A<LI><A HREF="#nocache">NoCache</A>
0N/A</UL>
0N/A
0N/A<HR>
0N/A
0N/A<A name="proxyrequests"><H2>ProxyRequests</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> ProxyRequests <EM>on/off</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <CODE>ProxyRequests Off</CODE><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> ProxyRequests is only available in
0N/AApache 1.1 and later.<P>
0N/A
0N/AThis allows or prevents Apache from functioning as a proxy
0N/Aserver. Setting ProxyRequests to 'off' does not disable use of the <A
0N/AHREF="#proxypass">ProxyPass</A> directive.
0N/A
0N/A<HR>
0N/A
0N/A<A name="proxyremote"><H2>ProxyRemote</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> ProxyRemote <EM>&lt;match&gt; &lt;remote-server&gt;</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <EM>None</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> ProxyRemote is only available in
0N/AApache 1.1 and later.<P>
0N/A
0N/AThis defines remote proxies to this proxy. &lt;match&gt; is either the
0N/Aname of a URL-scheme that the remote server supports, or a partial URL
0N/Afor which the remote server should be used, or '*' to indicate the
0N/Aserver should be contacted for all requests. &lt;remote-server&gt; is a
0N/Apartial URL for the remote server. Syntax:
0N/A
0N/A<PRE>
0N/A &lt;remote-server&gt; = &lt;protocol&gt;://&lt;hostname&gt;[:port]
0N/A</PRE>
0N/A
0N/A&lt;protocol&gt; is the protocol that should be used to communicate
0N/Awith the remote server; only "http" is supported by this module.
0N/A<P>
0N/AExample:
0N/A<PRE>
0N/A ProxyRemote http://goodguys.com/ http://mirrorguys.com:8000
0N/A ProxyRemote * http://cleversite.com
0N/A ProxyRemote ftp http://ftpproxy.mydomain.com:8080
0N/A</PRE>
0N/A
0N/AIn the last example, the proxy will forward FTP requests, encapsulated
0N/Aas yet another HTTP proxy request, to another proxy which can handle
0N/Athem.
0N/A
0N/A<HR>
0N/A
0N/A<A name="proxypass"><H2>ProxyPass</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> ProxyPass <EM>&lt;path&gt; &lt;url&gt;</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <EM>None</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> ProxyPass is only available in
0N/AApache 1.1 and later.<P>
0N/A
0N/AThis directive allows remote servers to be mapped into the space of the local
0N/Aserver; the local server does not act as a proxy in the conventional sense,
0N/Abut appears to be a mirror of the remote server. &lt;path&gt; is the name of
0N/Aa local virtual path; &lt;url&gt; is a partial URL for the remote server.
0N/A<P>
0N/ASuppose the local server has address <SAMP>http://wibble.org/</SAMP>; then
0N/A<PRE>
0N/A ProxyPass /mirror/foo http://foo.com
0N/A</PRE>
0N/Awill cause a local request for the
0N/A&lt;<SAMP>http://wibble.org/mirror/foo/bar</SAMP>&gt; to be
0N/Ainternally converted into a proxy request to
0N/A&lt;<SAMP>http://foo.com/bar</SAMP>&gt;.
0N/A
0N/A<HR>
0N/A
0N/A<A name="proxyblock"><H2>ProxyBlock</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> ProxyBlock <EM>&lt;word/host/domain list&gt;</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <EM>None</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> ProxyBlock is only available in
0N/AApache 1.2 and later.<P>
0N/A
0N/AThe ProxyBlock directive specifies a list of words, hosts and/or domains,
0N/Aseparated by spaces. HTTP, HTTPS, and FTP document requests to matched words,
0N/Ahosts or domains are <EM>blocked</EM> by the proxy server. The proxy module
0N/Awill also attempt to determine IP addresses of list items which may be
0N/Ahostnames during startup, and cache them for match test as well. Example:
0N/A
0N/A<PRE>
0N/A ProxyBlock joes_garage.com some_host.co.uk rocky.wotsamattau.edu
0N/A</PRE>
0N/A
0N/A'rocky.wotsamattau.edu' would also be matched if referenced by IP address.<P>
0N/A
0N/ANote that 'wotsamattau' would also be sufficient to match 'wotsamattau.edu'.<P>
0N/A
0N/ANote also that
0N/A
0N/A<PRE>
0N/AProxyBlock *
0N/A</PRE>
0N/A
0N/Ablocks connections to all sites.
0N/A
0N/A<HR>
0N/A
0N/A<A name="noproxy"><H2>NoProxy</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> NoProxy { <A HREF="#domain"><EM>&lt;Domain&gt;</EM></A>
0N/A | <A HREF="#subnet"><EM>&lt;SubNet&gt;</EM></A>
0N/A | <A HREF="#ipaddr"><EM>&lt;IpAddr&gt;</EM></A>
0N/A | <A HREF="#hostname"><EM>&lt;Hostname&gt;</EM></A>
0N/A } <BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <EM>None</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> NoProxy is only available in
0N/AApache 1.3 and later.<P>
0N/A
0N/AThis directive is only useful for Apache proxy servers within intranets.
0N/AThe NoProxy directive specifies a list of subnets, IP addresses, hosts
0N/Aand/or domains, separated by spaces. A request to a host which matches
0N/Aone or more of these is always served directly, without forwarding to
0N/Athe configured ProxyRemote proxy server(s).
0N/A<P>
0N/AExample:
0N/A
0N/A<PRE>
0N/A ProxyRemote * http://firewall.mycompany.com:81
0N/A NoProxy .mycompany.com 192.168.112.0/21
0N/A</PRE>
0N/AThe arguments to the NoProxy directive are one of the following type list:
0N/A <DL>
0N/A <!-- ===================== Domain ======================= -->
0N/A <A NAME="domain">
0N/A <DT><EM>Domain</EM></A>
0N/A <DD>A <EM>Domain</EM> is a partially qualified DNS domain name, preceded
0N/A by a period.
0N/A It represents a list of hosts which logically belong to the same DNS
0N/A domain or zone (i.e. the suffixes of the hostnames are all ending in
0N/A <EM>Domain</EM>).<BR>
0N/A Examples: <SAMP>.com</SAMP> <SAMP>.apache.org.</SAMP><BR>
0N/A To distinguish <EM>Domain</EM>s from <A HREF="#hostname"><EM>Hostname</EM></A>s (both
0N/A syntactically and semantically; a DNS domain can have a DNS A record,
0N/A too!), <EM>Domain</EM>s are always written
0N/A with a leading period.<BR>
0N/A Note: Domain name comparisons are done without regard to the case,
0N/A and <EM>Domain</EM>s are always assumed to be anchored in the root
0N/A of the DNS tree, therefore two domains <SAMP>.MyDomain.com</SAMP> and
0N/A <SAMP>.mydomain.com.</SAMP> (note the trailing period) are
0N/A considered equal. Since a domain comparison does not involve a DNS
0N/A lookup, it is much more efficient than subnet comparison.
0N/A
0N/A <!-- ===================== SubNet ======================= -->
0N/A <A NAME="subnet">
0N/A <DT><EM>SubNet</EM></A>
0N/A <DD>A <EM>SubNet</EM> is a partially qualified internet address in
0N/A numeric (dotted quad) form, optionally followed by a slash and the
0N/A netmask, specified as the number of significant bits in the
0N/A <EM>SubNet</EM>. It is used to represent a subnet of hosts which can
0N/A be reached over a common network interface. In the absence of the
0N/A explicit net mask it is assumed that omitted (or zero valued)
0N/A trailing digits specify the mask. (In this case, the netmask can
0N/A only be multiples of 8 bits wide.)<BR>
0N/A Examples:
0N/A <DL>
0N/A <DT><SAMP>192.168</SAMP> or <SAMP>192.168.0.0</SAMP>
0N/A <DD>the subnet 192.168.0.0 with an implied netmask of 16 valid bits
0N/A (sometimes used in the netmask form <SAMP>255.255.0.0</SAMP>)
0N/A <DT><SAMP>192.168.112.0/21</SAMP>
0N/A <DD>the subnet <SAMP>192.168.112.0/21</SAMP> with a netmask of 21
0N/A valid bits (also used in the form 255.255.248.0)
0N/A </DL>
0N/A As a degenerate case, a <EM>SubNet</EM> with 32 valid bits is the
0N/A equivalent to an <EM>IPAddr</EM>, while a <EM>SubNet</EM> with zero
0N/A valid bits (e.g., 0.0.0.0/0) is the same as the constant
0N/A <EM>_Default_</EM>, matching any IP address.
0N/A
0N/A <!-- ===================== IPAddr ======================= -->
0N/A <A NAME="ipaddr">
0N/A <DT><EM>IPAddr</EM></A>
0N/A <DD>A <EM>IPAddr</EM> represents a fully qualified internet address in
0N/A numeric (dotted quad) form. Usually, this address represents a
0N/A host, but there need not necessarily be a DNS domain name
0N/A connected with the address.<BR>
0N/A Example: 192.168.123.7<BR>
0N/A Note: An <EM>IPAddr</EM> does not need to be resolved by the DNS
0N/A system, so it can result in more effective apache performance.
0N/A <P><STRONG>See Also:</STRONG>
0N/A <A HREF="/dns-caveats.html">DNS Issues</A></P>
0N/A
0N/A <!-- ===================== Hostname ======================= -->
0N/A <A NAME="hostname">
0N/A <DT><EM>Hostname</EM></A>
0N/A <DD>A <EM>Hostname</EM> is a fully qualified DNS domain name which can
0N/A be resolved to one or more <A
0N/A HREF="#ipaddr"><EM>IPAddrs</EM></A> via the DNS domain name service.
0N/A It represents a logical host (in contrast to
0N/A <A HREF="#domain"><EM>Domain</EM></A>s, see
0N/A above) and must be resolvable to at least one <A
0N/A HREF="#ipaddr"><EM>IPAddr</EM></A> (or often to a list of hosts
0N/A with different <A HREF="#ipaddr"><EM>IPAddr</EM></A>'s).<BR>
0N/A Examples: <SAMP>prep.ai.mit.edu</SAMP>
0N/A <SAMP>www.apache.org.</SAMP><BR>
0N/A Note: In many situations, it is more effective to specify an
0N/A <A HREF="#ipaddr"><EM>IPAddr</EM></A> in place of a
0N/A <EM>Hostname</EM> since a DNS lookup
0N/A can be avoided. Name resolution in Apache can take a remarkable deal
0N/A of time when the connection to the name server uses a slow PPP
0N/A link.<BR>
0N/A Note: <EM>Hostname</EM> comparisons are done without regard to the case,
0N/A and <EM>Hostname</EM>s are always assumed to be anchored in the root
0N/A of the DNS tree, therefore two hosts <SAMP>WWW.MyDomain.com</SAMP>
0N/A and <SAMP>www.mydomain.com.</SAMP> (note the trailing period) are
0N/A considered equal.<BR>
0N/A<P><STRONG>See Also:</STRONG>
0N/A<A HREF="/dns-caveats.html">DNS Issues</A></P>
0N/A </DL>
0N/A
0N/A<HR>
0N/A
0N/A<A name="proxydomain"><H2>ProxyDomain</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> ProxyDomain <EM>&lt;Domain&gt;</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <EM>None</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> ProxyDomain is only available in
0N/AApache 1.3 and later.<P>
0N/A
0N/AThis directive is only useful for Apache proxy servers within intranets.
0N/AThe ProxyDomain directive specifies the default domain which the apache
0N/Aproxy server will belong to. If a request to a host without a domain name
0N/Ais encountered, a redirection response to the same host
0N/Awith the configured <EM>Domain</EM> appended will be generated.
0N/A<P>
0N/AExample:
0N/A
0N/A<PRE>
0N/A ProxyRemote * http://firewall.mycompany.com:81
0N/A NoProxy .mycompany.com 192.168.112.0/21
0N/A ProxyDomain .mycompany.com
0N/A</PRE>
0N/A
0N/A<HR>
0N/A
0N/A<A name="cacheroot"><H2>CacheRoot</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> CacheRoot <EM>&lt;directory&gt;</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <EM>None</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> CacheRoot is only available in
0N/AApache 1.1 and later.<P>
0N/A
0N/ASets the name of the directory to contain cache files; this must be
0N/Awritable
0N/Aby the httpd server.
0N/A
0N/A<HR>
0N/A
0N/A<A name="cachesize"><H2>CacheSize</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> CacheSize <EM>&lt;size&gt;</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <CODE>CacheSize 5</CODE><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> CacheSize is only available in
0N/AApache 1.1 and later.<P>
0N/A
0N/ASets the desired space usage of the cache, in KB (1024-byte units). Although
0N/Ausage may grow above this setting, the garbage collection will delete files
0N/Auntil the usage is at or below this setting.
0N/A
0N/A<HR>
0N/A
0N/A<A name="cachegcinterval"><H2>CacheGcInterval</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> CacheGcInterval <EM>&lt;time&gt;</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <EM>None</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> CacheGcinterval is only available in
0N/AApache 1.1 and later.<P>
0N/A
0N/ACheck the cache every &lt;time&gt; hours, and delete files if the space
0N/Ausage is greater than that set by CacheSize.
0N/A
0N/A<HR>
0N/A
0N/A<A name="cachemaxexpire"><H2>CacheMaxExpire</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> CacheMaxExpire <EM>&lt;time&gt;</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <CODE>CacheMaxExpire 24</CODE><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> CacheMaxExpire is only available in
0N/AApache 1.1 and later.<P>
0N/A
0N/ACachable HTTP documents will be retained for at most &lt;time&gt; hours without
0N/Achecking the origin server. Thus documents can be at most &lt;time&gt;
0N/Ahours out of date. This restriction is enforced even if an expiry date
0N/Awas supplied with the document.
0N/A
0N/A<HR>
0N/A
0N/A<A name="cachelastmodifiedfactor"><H2>CacheLastModifiedFactor</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> CacheLastModifiedFactor <EM>&lt;factor&gt;</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <CODE>CacheLastModifiedFactor 0.1</CODE><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> CacheLastModifiedFactor is only available in
0N/AApache 1.1 and later.<P>
0N/A
0N/AIf the origin HTTP server did not supply an expiry date for the
0N/Adocument, then estimate one using the formula
0N/A<PRE>
0N/A expiry-period = time-since-last-modification * &lt;factor&gt;
0N/A</PRE>
0N/AFor example, if the document was last modified 10 hours ago, and
0N/A&lt;factor&gt; is 0.1, then the expiry period will be set to 10*0.1 = 1 hour.
0N/A
0N/A<P>If the expiry-period would be longer than that set by CacheMaxExpire,
0N/Athen the latter takes precedence.
0N/A
0N/A<HR>
0N/A
0N/A<A name="cachedirlevels"><H2>CacheDirLevels</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> CacheDirLevels <EM>&lt;levels&gt;</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <CODE>CacheDirLevels 3</CODE><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> CacheDirLevels is only available in
0N/AApache 1.1 and later.<P>
0N/A
0N/ACacheDirLevels sets the number of levels of subdirectories in the cache.
0N/ACached data will be saved this many directory levels below CacheRoot.
0N/A
0N/A<HR>
0N/A
0N/A<A name="cachedirlength"><H2>CacheDirLength</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> CacheDirLength <EM>&lt;length&gt;</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <CODE>CacheDirLength 1</CODE><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
0N/A><STRONG>Compatibility:</STRONG></A> CacheDirLength is only available in
0N/AApache 1.1 and later.<P>
0N/A
0N/ACacheDirLength sets the number of characters in proxy cache subdirectory names.
0N/A
0N/A<HR>
0N/A
0N/A<A name="cachedefaultexpire"><H2>CacheDefaultExpire</H2></A>
0N/A<A
0N/A HREF="directive-dict.html#Syntax"
0N/A REL="Help"
0N/A><STRONG>Syntax:</STRONG></A> CacheDefaultExpire <EM>&lt;time&gt;</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Default"
0N/A REL="Help"
0N/A><STRONG>Default:</STRONG></A> <CODE>CacheDefaultExpire 1</CODE><BR>
0N/A<A
0N/A HREF="directive-dict.html#Context"
0N/A REL="Help"
0N/A><STRONG>Context:</STRONG></A> server config, virtual host<BR>
0N/A<A
0N/A HREF="directive-dict.html#Override"
0N/A REL="Help"
0N/A><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
0N/A<A
0N/A HREF="directive-dict.html#Status"
0N/A REL="Help"
0N/A><STRONG>Status:</STRONG></A> Base<BR>
0N/A<A
0N/A HREF="directive-dict.html#Module"
0N/A REL="Help"
0N/A><STRONG>Module:</STRONG></A> mod_proxy<BR>
0N/A<A
0N/A HREF="directive-dict.html#Compatibility"
0N/A REL="Help"
><STRONG>Compatibility:</STRONG></A> CacheDefaultExpire is only available in
Apache 1.1 and later.<P>
If the document is fetched via a protocol that does not support expiry times,
then use &lt;time&gt; hours as the expiry time.
<A HREF="#cachemaxexpire">CacheMaxExpire</A> does <STRONG>not</STRONG>
override this setting.
<HR>
<A name="nocache"><H2>NoCache</H2></A>
<A
HREF="directive-dict.html#Syntax"
REL="Help"
><STRONG>Syntax:</STRONG></A> NoCache <EM>&lt;word/host/domain list&gt;</EM><BR>
<A
HREF="directive-dict.html#Default"
REL="Help"
><STRONG>Default:</STRONG></A> <EM>None</EM><BR>
<A
HREF="directive-dict.html#Context"
REL="Help"
><STRONG>Context:</STRONG></A> server config, virtual host<BR>
<A
HREF="directive-dict.html#Override"
REL="Help"
><STRONG>Override:</STRONG></A> <EM>Not applicable</EM><BR>
<A
HREF="directive-dict.html#Status"
REL="Help"
><STRONG>Status:</STRONG></A> Base<BR>
<A
HREF="directive-dict.html#Module"
REL="Help"
><STRONG>Module:</STRONG></A> mod_proxy<BR>
<A
HREF="directive-dict.html#Compatibility"
REL="Help"
><STRONG>Compatibility:</STRONG></A> NoCache is only available in
Apache 1.1 and later.<P>
The NoCache directive specifies a list of words, hosts and/or domains, separated
by spaces. HTTP and non-passworded FTP documents from matched words, hosts or
domains are <EM>not</EM> cached by the proxy server. The proxy module will
also attempt to determine IP addresses of list items which may be hostnames
during startup, and cache them for match test as well. Example:
<PRE>
NoCache joes_garage.com some_host.co.uk bullwinkle.wotsamattau.edu
</PRE>
'bullwinkle.wotsamattau.edu' would also be matched if referenced by IP
address.<P>
Note that 'wotsamattau' would also be sufficient to match 'wotsamattau.edu'.<P>
Note also that
<PRE>
NoCache *
</PRE>
disables caching completely.<P>
<HR>
<A name="configs"><H2>Common configuration topics</H2></A>
<UL>
<LI><A HREF="#access">Controlling access to your proxy</A>
<LI><A HREF="#shortname">Using Netscape hostname shortcuts</A>
<LI><A HREF="#mimetypes">Why doesn't file type <EM>xxx</EM> download via FTP?</A>
<LI><A HREF="#startup">Why does Apache start more slowly when using the
proxy module?</A>
<LI><A HREF="#socks">Can I use the Apache proxy module with my SOCKS proxy?</A>
<LI><A HREF="#intranet">What other functions are useful for an intranet proxy server?</A>
</UL>
<H2><A name="access">Controlling access to your proxy</A></H2>
You can control who can access your proxy via the normal &lt;Directory&gt;
control block using the following example:<P>
<PRE>
&lt;Directory proxy:*&gt;
&lt;Limit GET PUT POST DELETE CONNECT OPTIONS&gt;
order deny,allow
deny from [machines you'd like *not* to allow by IP address or name]
allow from [machines you'd like to allow by IP address or name]
&lt;/Limit&gt;
&lt;/Directory&gt;
</PRE><P>
A &lt;Files&gt; block will also work, and is the only method known to work
for all possible URLs in Apache versions earlier than 1.2b10.<P>
<H2><A name="shortname">Using Netscape hostname shortcuts</A></H2>
There is an optional patch to the proxy module to allow Netscape-like
hostname shortcuts to be used. It's available
<A HREF="http://www.apache.org/dist/contrib/patches/1.2/netscapehost.patch">
here</A>.<P>
<H2><A name="mimetypes">Why doesn't file type <EM>xxx</EM> download via FTP?</A></H2>
You probably don't have that particular file type defined as
<EM>application/octet-stream</EM> in your proxy's mime.types configuration
file. A useful line can be<P>
<PRE>
application/octet-stream bin dms lha lzh exe class tgz taz
</PRE>
<H2><A name="type">How can I force an FTP ASCII download of File <EM>xxx</EM>?</A></H2>
In the rare situation where you must download a specific file using the FTP
<STRONG>ASCII</STRONG> transfer method (while the default transfer is in
<STRONG>binary</STRONG> mode), you can override mod_proxy's default by
suffixing the request with <SAMP>;type=a</SAMP> to force an ASCII transfer.<P>
<H2><A name="startup">Why does Apache start more slowly when using the
proxy module?</A></H2>
If you're using the <CODE>ProxyBlock</CODE> or <CODE>NoCache</CODE>
directives, hostnames' IP addresses are looked up and cached during
startup for later match test. This may take a few seconds (or more)
depending on the speed with which the hostname lookups occur.<P>
<H2><A name="socks">Can I use the Apache proxy module with my SOCKS proxy?</A></H2>
Yes. Just build Apache with the rule <CODE>SOCKS4=yes</CODE> in your
<EM>Configuration</EM> file, and follow the instructions there. SOCKS5
capability can be added in a similar way (there's no <CODE>SOCKS5</CODE>
rule yet), so use the <CODE>EXTRA_LDFLAGS</CODE> definition, or build Apache
normally and run it with the <EM>runsocks</EM> wrapper provided with SOCKS5,
if your OS supports dynamically linked libraries.<P>
Some users have reported problems when using SOCKS version 4.2 on Solaris.
The problem was solved by upgrading to SOCKS 4.3.<P>
Remember that you'll also have to grant access to your Apache proxy machine by
permitting connections on the appropriate ports in your SOCKS daemon's
configuration.<P>
<H2><A name="intranet">What other functions are useful for an intranet proxy server?</A></H2>
<P>An Apache proxy server situated in an intranet needs to forward external
requests through the company's firewall. However, when it has to access
resources within the intranet, it can bypass the firewall when accessing
hosts. The <A HREF="#noproxy">NoProxy</A> directive is useful for specifying
which hosts belong to the intranet and should be accessed directly.</P>
<P>Users within an intranet tend to omit the local domain name from their
WWW requests, thus requesting "http://somehost/" instead of
"http://somehost.my.dom.ain/". Some commercial proxy servers let them get
away with this and simply serve the request, implying a configured
local domain. When the <A HREF="#proxydomain">ProxyDomain</A> directive
is used and the server is <A HREF="#proxyrequests">configured for
proxy service</A>, Apache can return a redirect response and send the client
to the correct, fully qualified, server address. This is the preferred method
since the user's bookmark files will then contain fully qualified hosts.</P>
<!--#include virtual="footer.html" -->
</BODY>
</HTML>