mod_proxy.html revision dbbeec3dd1c06374ef9844ffe4071be9fb43dc9f
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>Apache module mod_proxy</TITLE>
</HEAD>
<BODY>
<!--#include virtual="header.html" -->
<H1>Apache module mod_proxy</h1>
is not compiled in by default. It provides for a caching proxy server.
It is only available in Apache 1.1 and later. Common configuration
questions are addressed <a href="#config">here</a>.
<h3>Note:</h3>
<p>This module was experimental in Apache 1.1.x. As of Apache 1.2, mod_proxy
stability is *greatly* improved.<p>
<h2>Summary</h2>
proxying capability for
<code>FTP</code>,
The module can be configured to connect to other proxy modules for these
and other protocols.
<h2>Directives</h2>
<ul>
<li><a href="#proxyrequests">ProxyRequests</a>
<li><a href="#proxyremote">ProxyRemote</a>
<li><a href="#proxypass">ProxyPass</a>
<li><a href="#cacheroot">CacheRoot</a>
<li><a href="#cachesize">CacheSize</a>
<li><a href="#cachegcinterval">CacheGcInterval</a>
<li><a href="#cachemaxexpire">CacheMaxExpire</a>
<li><a href="#cachelastmodifiedfactor">CacheLastModifiedFactor</a>
<li><a href="#cachedefaultexpire">CacheDefaultExpire</a>
<li><a href="#nocache">NoCache</a>
</ul>
<hr>
<A name="proxyrequests"><h2>ProxyRequests</h2></A>
<strong>Default:</strong> <code>ProxyRequests Off</code><br>
<strong>Context:</strong> server config<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> ProxyRequest is only available in
Apache 1.1 and later.<p>
This allows or prevents Apache from functioning as a proxy
server. Setting ProxyRequests to 'off' does not disable use of the <a
href="#proxypass">ProxyPass</a> directive.
<A name="proxyremote"><h2>ProxyRemote</h2></A>
<strong>Syntax:</strong> ProxyRemote <em><match> <remote-server></em><br>
<strong>Context:</strong> server config<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> ProxyRemote is only available in
Apache 1.1 and later.<p>
This defines remote proxies to this proxy. <match> is either the
name of a URL-scheme that the remote server supports, or a partial URL
for which the remote server should be used, or '*' to indicate the
server should be contacted for all requests. <remote-server> is a
partial URL for the remote server. Syntax:
<pre>
<remote-server> = <protocol>://<hostname>[:port]
</pre>
<protocol> is the protocol that should be used to communicate
with the remote server; only "http" is supported by this module.
Example:
<pre>
ProxyRemote http://goodguys.com/ http://mirrorguys.com:8000
ProxyRemote * http://cleversite.com
ProxyRemote ftp http://ftpproxy.mydomain.com:8080
</pre>
In the last example, the proxy will forward FTP requests, encapsulated
as yet another HTTP proxy request, to another proxy which can handle
them. Apache itself can not directly handle FTP requests currently.
<A name="proxypass"><h2>ProxyPass</h2></A>
<strong>Syntax:</strong> ProxyPass <em><path> <url></em><br>
<strong>Context:</strong> server config<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> ProxyPass is only available in
Apache 1.1 and later.<p>
This directive allows remote servers to be mapped into the space of the local
server; the local server does not act as a proxy in the conventional sense,
but appears to be a mirror of the remote server. <path> is the name of
a local virtual path; <url> is a partial URL for the remote server.
Suppose the local server has address http://wibble.org; then
<pre>
</pre>
Will cause a local request for the http://wibble.org/mirror/foo/bar to be
internally converted into a proxy request to http://foo.com/bar
<A name="cacheroot"><h2>CacheRoot</h2></A>
<strong>Syntax:</strong> CacheRoot <em><directory></em><br>
<strong>Context:</strong> server config<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> CacheRoot is only available in
Apache 1.1 and later.<p>
Sets the name of the directory to contain cache files; this must be
writable
by the httpd server.
<A name="cachesize"><h2>CacheSize</h2></A>
<strong>Syntax:</strong> CacheSize <em><size></em><br>
<strong>Default:</strong> <code>CacheSize 5</code><br>
<strong>Context:</strong> server config<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> CacheSize is only available in
Apache 1.1 and later.<p>
Sets the desired space usage of the cache, in Kb (1024 byte units). Although
usage may grow above this setting, the garbage collection will delete files
until the usage is at or below this setting.
<A name="cachegcinterval"><h2>CacheGcInterval</h2></A>
<strong>Syntax:</strong> CacheGcInterval <em><time></em><br>
<strong>Context:</strong> server config<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> CacheGcinterval is only available in
Apache 1.1 and later.<p>
Check the cache every <time> hours, and delete files if the space
usage is greater than that set by CacheSize.
<A name="cachemaxexpire"><h2>CacheMaxExpire</h2></A>
<strong>Syntax:</strong> CacheMaxExpire <em><time></em><br>
<strong>Default:</strong> </code>CacheMaxExpire 24</code><br>
<strong>Context:</strong> server config<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> CacheMaxExpire is only available in
Apache 1.1 and later.<p>
Cachable HTTP documents will be retained for at most <time> hours without
checking the origin server. Thus documents can be at most <time>
hours out of date. This restriction is enforced even if an expiry date
was supplied with the document.
<A name="cachelastmodifiedfactor"><h2>CacheLastModifiedFactor</h2></A>
<strong>Syntax:</strong> CacheLastModifiedFactor <em><factor></em><br>
<strong>Default:</strong> </code>CacheLastModifiedFactor 0.1</code><br>
<strong>Context:</strong> server config<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> CacheLastModified is only available in
Apache 1.1 and later.<p>
If the origin HTTP server did not supply an expiry date for the
document, then estimate on using the formula
<pre>
expiry-period = time-since-last-modification * <factor>
</pre>
For example, if the document was last modified 10 hours ago, and
<factor> is 0.1, then the expiry period will be set to 10*0.1 = 1 hour.
<p>If the expiry-period would be longer than that set by CacheMaxExpire,
then the latter takes precedence.
<A name="cachedefaultexpire"><h2>CacheDefaultExpire</h2></A>
<strong>Syntax:</strong> CacheDefaultExpire <em><time></em><br>
<strong>Default:</strong> </code>CacheDefaultExpire 1</code><br>
<strong>Context:</strong> server config<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> CacheDefaultExpire is only available in
Apache 1.1 and later.<p>
If the document is fetched via a protocol that does not support expirytimes,
then use <time> hours as the expiry time.
<a href="#cachemaxexpire">CacheMaxExpire</a> does <strong>not</strong>
override.
<A name="nocache"><h2>NoCache</h2></A>
<strong>Context:</strong> server config<br>
<strong>Status:</strong> Base<br>
<strong>Module:</strong> mod_proxy<br>
<strong>Compatibility:</strong> NoCache is only available in
Apache 1.1 and later.<p>
by spaces. HTTP documents from hosts or domains in the list are <em>not</em>
cached by the proxy server. Example:
<pre>
</pre>
Note that 'wotsamattau' would also be sufficient to match 'wotsamattau.edu'.
<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 <i>xxx</i> download via FTP?</a>
</ul>
<a name="access"><h2>Controlling access to your proxy</h2>
You can control who can access your proxy via the normal <Directory>
control block using the following example:<p>
<pre>
<Directory proxy:*>
order allow,deny
deny from [machines you'd like not to allow by IP address or name]
allow from all
</Directory>
</pre><p>
<a name="shortname"><h2>Using Netscape hostname shortcuts</h2>
There is an optional patch to the proxy module to allow Netscape-like
hostname shortcuts to be used. It's available
here</a>.<p>
<a name="mimetypes"><h2>Why doesn't file type <i>xxx</i> download via FTP?</h2>
You probably don't have that particular file type defined as
file. A useful line can be<p>
<pre>
application/octet-stream bin dms lha lzh exe class tgz taz
</pre>
<!--#include virtual="footer.html" -->
</BODY>
</HTML>