]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_proxy.html.en
Patch contributed by: Daniel Rall <dlr@apache.org>
[apache] / docs / manual / mod / mod_proxy.html.en
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>mod_proxy - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
13 <body>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.1</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
19 <div id="path">
20 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs-project/">Documentation</a> &gt; <a href="../">Version 2.1</a> &gt; <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_proxy</h1>
23 <div class="toplang">
24 <p><span>Available Languages: </span><a href="../en/mod/mod_proxy.html" title="English">&nbsp;en&nbsp;</a> |
25 <a href="../ja/mod/mod_proxy.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
26 </div>
27 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>HTTP/1.1 proxy/gateway server</td></tr>
28 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
29 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>proxy_module</td></tr>
30 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_proxy.c</td></tr></table>
31 <h3>Summary</h3>
32
33     <div class="warning"><h3>Warning</h3>
34       <p>Do not enable proxying with <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> until you have <a href="#access">secured your server</a>. Open proxy servers are dangerous both to your
35       network and to the Internet at large.</p>
36     </div>
37
38     <p>This module implements a proxy/gateway for Apache. It implements
39     proxying capability for <code>AJP13</code> (Apache JServe Protocol
40     version 1.3), <code>FTP</code>, <code>CONNECT</code> (for SSL),
41     <code>HTTP/0.9</code>, <code>HTTP/1.0</code>, and <code>HTTP/1.1</code>.
42     The module can be configured to connect to other proxy modules for these
43     and other protocols.</p>
44
45     <p>Apache's proxy features are divided into several modules in
46     addition to <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>:
47     <code class="module"><a href="../mod/mod_proxy_http.html">mod_proxy_http</a></code>, <code class="module"><a href="../mod/mod_proxy_ftp.html">mod_proxy_ftp</a></code>,
48     <code class="module"><a href="../mod/mod_proxy_ajp.html">mod_proxy_ajp</a></code>, <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code>,
49     and <code class="module"><a href="../mod/mod_proxy_connect.html">mod_proxy_connect</a></code>.  Thus, if you want to use
50     one or more of the particular proxy functions, load
51     <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> <em>and</em> the appropriate module(s)
52     into the server (either statically at compile-time or dynamically
53     via the <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>
54     directive).</p>
55
56     <p>In addition, extended features are provided by other modules.
57     Caching is provided by <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> and related
58     modules.  The ability to contact remote servers using the SSL/TLS
59     protocol is provided by the <code>SSLProxy*</code> directives of
60     <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code>.  These additional modules will need
61     to be loaded and configured to take advantage of these features.</p>
62 </div>
63 <div id="quickview"><h3 class="directives">Directives</h3>
64 <ul id="toc">
65 <li><img alt="" src="../images/down.gif" /> <a href="#allowconnect">AllowCONNECT</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#noproxy">NoProxy</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#proxy">&lt;Proxy&gt;</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#proxybadheader">ProxyBadHeader</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#proxyblock">ProxyBlock</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#proxydomain">ProxyDomain</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#proxyerroroverride">ProxyErrorOverride</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#proxyiobuffersize">ProxyIOBufferSize</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#proxymatch">&lt;ProxyMatch&gt;</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#proxymaxforwards">ProxyMaxForwards</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#proxypass">ProxyPass</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#proxypassreverse">ProxyPassReverse</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#proxypassreversecookiedomain">ProxyPassReverseCookieDomain</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#proxypassreversecookiepath">ProxyPassReverseCookiePath</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#proxypreservehost">ProxyPreserveHost</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#proxyreceivebuffersize">ProxyReceiveBufferSize</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#proxyremote">ProxyRemote</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#proxyremotematch">ProxyRemoteMatch</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#proxyrequests">ProxyRequests</a></li>
84 <li><img alt="" src="../images/down.gif" /> <a href="#proxytimeout">ProxyTimeout</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#proxyvia">ProxyVia</a></li>
86 </ul>
87 <h3>Topics</h3>
88 <ul id="topics">
89 <li><img alt="" src="../images/down.gif" /> <a href="#forwardreverse">Forward and Reverse Proxies</a></li>
90 <li><img alt="" src="../images/down.gif" /> <a href="#examples">Basic Examples</a></li>
91 <li><img alt="" src="../images/down.gif" /> <a href="#access">Controlling access to your proxy</a></li>
92 <li><img alt="" src="../images/down.gif" /> <a href="#ftp-proxy">FTP Proxy</a></li>
93 <li><img alt="" src="../images/down.gif" /> <a href="#startup">Slow Startup</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#intranet">Intranet Proxy</a></li>
95 <li><img alt="" src="../images/down.gif" /> <a href="#envsettings">Protocol Adjustments</a></li>
96 </ul><h3>See also</h3>
97 <ul class="seealso">
98 <li><code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code></li>
99 <li><code class="module"><a href="../mod/mod_proxy_http.html">mod_proxy_http</a></code></li>
100 <li><code class="module"><a href="../mod/mod_proxy_ftp.html">mod_proxy_ftp</a></code></li>
101 <li><code class="module"><a href="../mod/mod_proxy_connect.html">mod_proxy_connect</a></code></li>
102 <li><code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code></li>
103 <li><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></li>
104 </ul></div>
105 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
106 <div class="section">
107 <h2><a name="forwardreverse" id="forwardreverse">Forward and Reverse Proxies</a></h2>
108       <p>Apache can be configured in both a <dfn>forward</dfn> and
109       <dfn>reverse</dfn> proxy mode.</p>
110
111       <p>An ordinary <dfn>forward proxy</dfn> is an intermediate
112       server that sits between the client and the <em>origin
113       server</em>.  In order to get content from the origin server,
114       the client sends a request to the proxy naming the origin server
115       as the target and the proxy then requests the content from the
116       origin server and returns it to the client.  The client must be
117       specially configured to use the forward proxy to access other
118       sites.</p>
119
120       <p>A typical usage of a forward proxy is to provide Internet
121       access to internal clients that are otherwise restricted by a
122       firewall.  The forward proxy can also use caching (as provided
123       by <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code>) to reduce network usage.</p>
124
125       <p>The forward proxy is activated using the <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> directive.  Because
126       forward proxys allow clients to access arbitrary sites through
127       your server and to hide their true origin, it is essential that
128       you <a href="#access">secure your server</a> so that only
129       authorized clients can access the proxy before activating a
130       forward proxy.</p>
131
132       <p>A <dfn>reverse proxy</dfn>, by contrast, appears to the
133       client just like an ordinary web server.  No special
134       configuration on the client is necessary.  The client makes
135       ordinary requests for content in the name-space of the reverse
136       proxy.  The reverse proxy then decides where to send those
137       requests, and returns the content as if it was itself the
138       origin.</p>
139
140       <p>A typical usage of a reverse proxy is to provide Internet
141       users access to a server that is behind a firewall.  Reverse
142       proxies can also be used to balance load among several back-end
143       servers, or to provide caching for a slower back-end server.
144       In addition, reverse proxies can be used simply to bring
145       several servers into the same URL space.</p>
146
147       <p>A reverse proxy is activated using the <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive or the
148       <code>[P]</code> flag to the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> directive.  It is
149       <strong>not</strong> necessary to turn <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> on in order to
150       configure a reverse proxy.</p>
151     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
152 <div class="section">
153 <h2><a name="examples" id="examples">Basic Examples</a></h2>
154
155     <p>The examples below are only a very basic idea to help you
156     get started.  Please read the documentation on the individual
157     directives.</p>
158
159     <p>In addition, if you wish to have caching enabled, consult
160     the documentation from <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code>.</p>
161
162     <div class="example"><h3>Forward Proxy</h3><p><code>
163     ProxyRequests On<br />
164     ProxyVia On<br />
165     <br />
166     &lt;Proxy *&gt;<br />
167     <span class="indent">
168       Order deny,allow<br />
169       Deny from all<br />
170       Allow from internal.example.com<br />
171     </span>
172     &lt;/Proxy&gt;
173     </code></p></div>
174
175     <div class="example"><h3>Reverse Proxy</h3><p><code>
176     ProxyRequests Off<br />
177     <br />
178     &lt;Proxy *&gt;<br />
179     <span class="indent">
180       Order deny,allow<br />
181       Allow from all<br />
182     </span>
183     &lt;/Proxy&gt;<br />
184     <br />
185     ProxyPass /foo http://foo.example.com/bar<br />
186     ProxyPassReverse /foo http://foo.example.com/bar
187     </code></p></div>
188     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
189 <div class="section">
190 <h2><a name="access" id="access">Controlling access to your proxy</a></h2>
191       <p>You can control who can access your proxy via the <code class="directive"><a href="#proxy">&lt;Proxy&gt;</a></code> control block as in
192       the following example:</p>
193
194       <div class="example"><p><code>
195         &lt;Proxy *&gt;<br />
196         <span class="indent">
197           Order Deny,Allow<br />
198           Deny from all<br />
199           Allow from 192.168.0<br />
200         </span>
201         &lt;/Proxy&gt;
202       </code></p></div>
203
204       <p>For more information on access control directives, see
205       <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code>.</p>
206
207       <p>Strictly limiting access is essential if you are using a
208       forward proxy (using the <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> directive).
209       Otherwise, your server can be used by any client to access
210       arbitrary hosts while hiding his or her true identity.  This is
211       dangerous both for your network and for the Internet at large.
212       When using a reverse proxy (using the <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive with
213       <code>ProxyRequests Off</code>), access control is less
214       critical because clients can only contact the hosts that you
215       have specifically configured.</p>
216
217     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
218 <div class="section">
219 <h2><a name="ftp-proxy" id="ftp-proxy">FTP Proxy</a></h2>
220
221
222     <h3><a name="mimetypes" id="mimetypes">Why doesn't file type <var>xxx</var>
223     download via FTP?</a></h3>
224       <p>You probably don't have that particular file type defined as
225       <code>application/octet-stream</code> in your proxy's mime.types
226       configuration file. A useful line can be</p>
227
228       <div class="example"><pre>application/octet-stream   bin dms lha lzh exe class tgz taz</pre></div>
229         <p>Alternatively you may prefer to default everything to binary:</p>
230       <div class="example"><pre>DefaultType application/octet-stream</pre></div>
231      
232
233     <h3><a name="type" id="type">How can I force an FTP ASCII download of
234     File <var>xxx</var>?</a></h3>
235       <p>In the rare situation where you must download a specific file using the
236       FTP <code>ASCII</code> transfer method (while the default transfer is in
237       <code>binary</code> mode), you can override <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>'s
238       default by suffixing the request with <code>;type=a</code> to force an
239       ASCII transfer. (FTP Directory listings are always executed in ASCII mode,
240       however.)</p>
241      
242
243     <h3><a name="ftpnonget" id="ftpnonget">How can I do FTP upload?</a></h3>
244         <p>Currently, only GET is supported for FTP in mod_proxy.  You can
245         of course use HTTP upload (POST or PUT) through an Apache proxy.</p>
246     
247
248     <h3><a name="percent2fhck" id="percent2fhck">How can I access FTP files outside
249     of my home directory?</a></h3>
250       <p>An FTP URI is interpreted relative to the home directory of the user
251       who is logging in. Alas, to reach higher directory levels you cannot
252       use /../, as the dots are interpreted by the browser and not actually
253       sent to the FTP server. To address this problem, the so called <dfn>Squid
254       %2f hack</dfn> was implemented in the Apache FTP proxy; it is a
255       solution which is also used by other popular proxy servers like the <a href="http://www.squid-cache.org/">Squid Proxy Cache</a>. By
256       prepending <code>/%2f</code> to the path of your request, you can make
257       such a proxy change the FTP starting directory to <code>/</code> (instead
258       of the home directory). For example, to retrieve the file
259       <code>/etc/motd</code>, you would use the URL:</p>
260
261       <div class="example"><p><code>
262         ftp://<var>user</var>@<var>host</var>/%2f/etc/motd
263       </code></p></div>
264      
265
266     <h3><a name="ftppass" id="ftppass">How can I hide the FTP cleartext password
267     in my browser's URL line?</a></h3>
268       <p>To log in to an FTP server by username and password, Apache uses
269       different strategies. In absense of a user name and password in the URL
270       altogether, Apache sends an anonymous login to the FTP server,
271       <em>i.e.</em>,</p>
272
273       <div class="example"><p><code>
274         user: anonymous<br />
275         password: apache_proxy@
276       </code></p></div>
277
278       <p>This works for all popular FTP servers which are configured for
279       anonymous access.</p>
280
281       <p>For a personal login with a specific username, you can embed the user
282       name into the URL, like in:</p>
283
284       <div class="example"><p><code>
285         ftp://<var>username</var>@<var>host</var>/myfile
286       </code></p></div>
287
288       <p>If the FTP server asks for a password when given this username (which
289       it should), then Apache will reply with a <code>401</code> (Authorization
290       required) response, which causes the Browser to pop up the
291       username/password dialog. Upon entering the password, the connection
292       attempt is retried, and if successful, the requested resource is
293       presented. The advantage of this procedure is that your browser does not
294       display the password in cleartext (which it would if you had used</p>
295
296       <div class="example"><p><code>
297         ftp://<var>username</var>:<var>password</var>@<var>host</var>/myfile
298       </code></p></div>
299
300       <p>in the first place).</p>
301
302       <div class="note"><h3>Note</h3>
303         <p>The password which is transmitted in such a way is not encrypted on
304         its way. It travels between your browser and the Apache proxy server in
305         a base64-encoded cleartext string, and between the Apache proxy and the
306         FTP server as plaintext. You should therefore think twice before
307         accessing your FTP server via HTTP (or before accessing your personal
308         files via FTP at all!) When using unsecure channels, an eavesdropper
309         might intercept your password on its way.</p>
310       </div>
311      
312    </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
313 <div class="section">
314 <h2><a name="startup" id="startup">Slow Startup</a></h2>
315       <p>If you're using the <code class="directive"><a href="#proxyblock">ProxyBlock</a></code> directive, hostnames' IP addresses are looked up
316       and cached during startup for later match test. This may take a few
317       seconds (or more) depending on the speed with which the hostname lookups
318       occur.</p>
319     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
320 <div class="section">
321 <h2><a name="intranet" id="intranet">Intranet Proxy</a></h2>
322       <p>An Apache proxy server situated in an intranet needs to forward
323       external requests through the company's firewall (for this, configure
324       the <code class="directive"><a href="#proxyremote">ProxyRemote</a></code> directive
325       to forward the respective <var>scheme</var> to the firewall proxy).
326       However, when it has to
327       access resources within the intranet, it can bypass the firewall when
328       accessing hosts. The <code class="directive"><a href="#noproxy">NoProxy</a></code>
329       directive is useful for specifying which hosts belong to the intranet and
330       should be accessed directly.</p>
331
332       <p>Users within an intranet tend to omit the local domain name from their
333       WWW requests, thus requesting "http://somehost/" instead of
334       <code>http://somehost.example.com/</code>. Some commercial proxy servers
335       let them get away with this and simply serve the request, implying a
336       configured local domain. When the <code class="directive"><a href="#proxydomain">ProxyDomain</a></code> directive is used and the server is <a href="#proxyrequests">configured for proxy service</a>, Apache can return
337       a redirect response and send the client to the correct, fully qualified,
338       server address. This is the preferred method since the user's bookmark
339       files will then contain fully qualified hosts.</p>
340     </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
341 <div class="section">
342 <h2><a name="envsettings" id="envsettings">Protocol Adjustments</a></h2>
343       <p>For circumstances where you have a application server which doesn't
344       implement keepalives or HTTP/1.1 properly, there are 2 environment
345       variables which when set send a HTTP/1.0 with no keepalive. These are set
346       via the  <code class="directive"><a href="../mod/mod_env.html#setenv">SetEnv</a></code> directive.</p>
347
348       <p>These are the <code>force-proxy-request-1.0</code> and
349       <code>proxy-nokeepalive</code> notes.</p>
350
351       <div class="example"><p><code>
352         &lt;Location /buggyappserver/&gt;<br />
353         <span class="indent">
354           ProxyPass http://buggyappserver:7001/foo/<br />
355           SetEnv force-proxy-request-1.0 1<br />
356           SetEnv proxy-nokeepalive 1<br />
357         </span>
358         &lt;/Location&gt;
359       </code></p></div>
360     </div>
361 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
362 <div class="directive-section"><h2><a name="AllowCONNECT" id="AllowCONNECT">AllowCONNECT</a> <a name="allowconnect" id="allowconnect">Directive</a></h2>
363 <table class="directive">
364 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Ports that are allowed to <code>CONNECT</code> through the
365 proxy</td></tr>
366 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowCONNECT <var>port</var> [<var>port</var>] ...</code></td></tr>
367 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowCONNECT 443 563</code></td></tr>
368 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
369 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
370 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
371 </table>
372     <p>The <code class="directive">AllowCONNECT</code> directive specifies a list
373     of port numbers to which the proxy <code>CONNECT</code> method may
374     connect.  Today's browsers use this method when a <code>https</code>
375     connection is requested and proxy tunneling over HTTP is in effect.</p>
376
377     <p>By default, only the default https port (<code>443</code>) and the
378     default snews port (<code>563</code>) are enabled. Use the
379     <code class="directive">AllowCONNECT</code> directive to override this default and
380     allow connections to the listed ports only.</p>
381
382     <p>Note that you'll need to have <code class="module"><a href="../mod/mod_proxy_connect.html">mod_proxy_connect</a></code> present
383     in the server in order to get the support for the <code>CONNECT</code> at
384     all.</p>
385
386 </div>
387 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
388 <div class="directive-section"><h2><a name="NoProxy" id="NoProxy">NoProxy</a> <a name="noproxy" id="noproxy">Directive</a></h2>
389 <table class="directive">
390 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Hosts, domains, or networks that will be connected to
391 directly</td></tr>
392 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NoProxy <var>host</var> [<var>host</var>] ...</code></td></tr>
393 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
394 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
395 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
396 </table>
397     <p>This directive is only useful for Apache proxy servers within
398     intranets.  The <code class="directive">NoProxy</code> directive specifies a
399     list of subnets, IP addresses, hosts and/or domains, separated by
400     spaces. A request to a host which matches one or more of these is
401     always served directly, without forwarding to the configured
402     <code class="directive"><a href="#proxyremote">ProxyRemote</a></code> proxy server(s).</p>
403
404     <div class="example"><h3>Example</h3><p><code>
405       ProxyRemote  *  http://firewall.mycompany.com:81<br />
406       NoProxy         .mycompany.com 192.168.112.0/21
407     </code></p></div>
408
409     <p>The <var>host</var> arguments to the <code class="directive">NoProxy</code>
410     directive are one of the following type list:</p>
411
412     <dl>
413     
414     <dt><var><a name="domain" id="domain">Domain</a></var></dt>
415     <dd>
416     <p>A <dfn>Domain</dfn> is a partially qualified DNS domain name, preceded
417     by a period. It represents a list of hosts which logically belong to the
418     same DNS domain or zone (<em>i.e.</em>, the suffixes of the hostnames are
419     all ending in <var>Domain</var>).</p>
420
421     <div class="example"><h3>Examples</h3><p><code>
422       .com .apache.org.
423     </code></p></div>
424
425     <p>To distinguish <var>Domain</var>s from <var><a href="#hostname">Hostname</a></var>s (both syntactically and semantically; a DNS domain can
426     have a DNS A record, too!), <var>Domain</var>s are always written with a
427     leading period.</p>
428     
429     <div class="note"><h3>Note</h3>
430       <p>Domain name comparisons are done without regard to the case, and
431       <var>Domain</var>s are always assumed to be anchored in the root of the
432       DNS tree, therefore two domains <code>.MyDomain.com</code> and
433       <code>.mydomain.com.</code> (note the trailing period) are considered
434       equal. Since a domain comparison does not involve a DNS lookup, it is much
435       more efficient than subnet comparison.</p>
436     </div></dd>
437
438     
439     <dt><var><a name="subnet" id="subnet">SubNet</a></var></dt>
440     <dd>
441     <p>A <dfn>SubNet</dfn> is a partially qualified internet address in
442     numeric (dotted quad) form, optionally followed by a slash and the netmask,
443     specified as the number of significant bits in the <var>SubNet</var>. It is
444     used to represent a subnet of hosts which can be reached over a common
445     network interface. In the absence of the explicit net mask it is assumed
446     that omitted (or zero valued) trailing digits specify the mask. (In this
447     case, the netmask can only be multiples of 8 bits wide.) Examples:</p>
448
449     <dl>
450     <dt><code>192.168</code> or <code>192.168.0.0</code></dt>
451     <dd>the subnet 192.168.0.0 with an implied netmask of 16 valid bits
452     (sometimes used in the netmask form <code>255.255.0.0</code>)</dd>
453     <dt><code>192.168.112.0/21</code></dt>
454     <dd>the subnet <code>192.168.112.0/21</code> with a netmask of 21
455     valid bits (also used in the form <code>255.255.248.0</code>)</dd>
456     </dl>
457
458     <p>As a degenerate case, a <em>SubNet</em> with 32 valid bits is the
459     equivalent to an <var><a href="#ipadr">IPAddr</a></var>, while a <var>SubNet</var> with zero
460     valid bits (<em>e.g.</em>, 0.0.0.0/0) is the same as the constant
461     <var>_Default_</var>, matching any IP address.</p></dd>
462
463     
464     <dt><var><a name="ipaddr" id="ipaddr">IPAddr</a></var></dt>
465     <dd>
466     <p>A <dfn>IPAddr</dfn> represents a fully qualified internet address in
467     numeric (dotted quad) form. Usually, this address represents a host, but
468     there need not necessarily be a DNS domain name connected with the
469     address.</p>
470     <div class="example"><h3>Example</h3><p><code>
471       192.168.123.7
472     </code></p></div>
473     
474     <div class="note"><h3>Note</h3>
475       <p>An <var>IPAddr</var> does not need to be resolved by the DNS system, so
476       it can result in more effective apache performance.</p>
477     </div></dd>
478
479     
480     <dt><var><a name="hostname" id="hostname">Hostname</a></var></dt>
481     <dd>
482     <p>A <dfn>Hostname</dfn> is a fully qualified DNS domain name which can
483     be resolved to one or more <var><a href="#ipaddr">IPAddrs</a></var> via the
484     DNS domain name service. It represents a logical host (in contrast to
485         <var><a href="#domain">Domain</a></var>s, see above) and must be resolvable
486     to at least one <var><a href="#ipaddr">IPAddr</a></var> (or often to a list
487     of hosts with different <var><a href="#ipaddr">IPAddr</a></var>s).</p>
488
489     <div class="example"><h3>Examples</h3><p><code>
490       prep.ai.mit.edu<br />
491       www.apache.org
492     </code></p></div>
493
494     <div class="note"><h3>Note</h3>
495       <p>In many situations, it is more effective to specify an <var><a href="#ipaddr">IPAddr</a></var> in place of a <var>Hostname</var> since a
496       DNS lookup can be avoided. Name resolution in Apache can take a remarkable
497       deal of time when the connection to the name server uses a slow PPP
498       link.</p>
499       <p><var>Hostname</var> comparisons are done without regard to the case,
500       and <var>Hostname</var>s are always assumed to be anchored in the root
501       of the DNS tree, therefore two hosts <code>WWW.MyDomain.com</code>
502       and <code>www.mydomain.com.</code> (note the trailing period) are
503       considered equal.</p>
504      </div></dd>
505     </dl>
506
507 <h3>See also</h3>
508 <ul>
509 <li><a href="../dns-caveats.html">DNS Issues</a></li>
510 </ul>
511 </div>
512 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
513 <div class="directive-section"><h2><a name="Proxy" id="Proxy">&lt;Proxy&gt;</a> <a name="proxy" id="proxy">Directive</a></h2>
514 <table class="directive">
515 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Container for directives applied to proxied resources</td></tr>
516 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;Proxy <var>wildcard-url</var>&gt; ...&lt;/Proxy&gt;</code></td></tr>
517 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
518 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
519 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
520 </table>
521     <p>Directives placed in <code class="directive">&lt;Proxy&gt;</code>
522     sections apply only to matching proxied content.  Shell-style wildcards are
523     allowed.</p>
524
525     <p>For example, the following will allow only hosts in
526     <code>yournetwork.example.com</code> to access content via your proxy
527     server:</p>
528
529     <div class="example"><p><code>
530       &lt;Proxy *&gt;<br />
531       <span class="indent">
532         Order Deny,Allow<br />
533         Deny from all<br />
534         Allow from yournetwork.example.com<br />
535       </span>
536       &lt;/Proxy&gt;
537     </code></p></div>
538
539     <p>The following example will process all files in the <code>foo</code>
540     directory of <code>example.com</code> through the <code>INCLUDES</code>
541     filter when they are sent through the proxy server:</p>
542
543     <div class="example"><p><code>
544       &lt;Proxy http://example.com/foo/*&gt;<br />
545       <span class="indent">
546         SetOutputFilter INCLUDES<br />
547       </span>
548       &lt;/Proxy&gt;
549     </code></p></div>
550
551
552 </div>
553 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
554 <div class="directive-section"><h2><a name="ProxyBadHeader" id="ProxyBadHeader">ProxyBadHeader</a> <a name="proxybadheader" id="proxybadheader">Directive</a></h2>
555 <table class="directive">
556 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines how to handle bad header lines in a
557 response</td></tr>
558 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyBadHeader IsError|Ignore|StartBody</code></td></tr>
559 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyBadHeader IsError</code></td></tr>
560 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
561 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
562 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
563 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>available in Apache 2.0.44 and later</td></tr>
564 </table>
565     <p>The <code class="directive">ProxyBadHeader</code> directive determines the
566     behaviour of <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> if it receives syntactically invalid
567     header lines (<em>i.e.</em> containing no colon). The following arguments
568     are possible:</p>
569
570     <dl>
571     <dt><code>IsError</code></dt>
572     <dd>Abort the request and end up with a 502 (Bad Gateway) response. This is
573     the default behaviour.</dd>
574
575     <dt><code>Ignore</code></dt>
576     <dd>Treat bad header lines as if they weren't sent.</dd>
577
578     <dt><code>StartBody</code></dt>
579     <dd>When receiving the first bad header line, finish reading the headers and
580     treat the remainder as body. This helps to work around buggy backend servers
581     which forget to insert an empty line between the headers and the body.</dd>
582     </dl>
583
584 </div>
585 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
586 <div class="directive-section"><h2><a name="ProxyBlock" id="ProxyBlock">ProxyBlock</a> <a name="proxyblock" id="proxyblock">Directive</a></h2>
587 <table class="directive">
588 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Words, hosts, or domains that are banned from being
589 proxied</td></tr>
590 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyBlock *|<var>word</var>|<var>host</var>|<var>domain</var>
591 [<var>word</var>|<var>host</var>|<var>domain</var>] ...</code></td></tr>
592 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
593 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
594 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
595 </table>
596     <p>The <code class="directive">ProxyBlock</code> directive specifies a list of
597     words, hosts and/or domains, separated by spaces.  HTTP, HTTPS, and
598     FTP document requests to sites whose names contain matched words,
599     hosts or domains are <em>blocked</em> by the proxy server. The proxy
600     module will also attempt to determine IP addresses of list items which
601     may be hostnames during startup, and cache them for match test as
602     well. That may slow down the startup time of the server.</p>
603
604     <div class="example"><h3>Example</h3><p><code>
605       ProxyBlock joes-garage.com some-host.co.uk rocky.wotsamattau.edu
606     </code></p></div>
607
608     <p><code>rocky.wotsamattau.edu</code> would also be matched if referenced by
609     IP address.</p>
610
611     <p>Note that <code>wotsamattau</code> would also be sufficient to match
612     <code>wotsamattau.edu</code>.</p>
613
614     <p>Note also that</p>
615
616     <div class="example"><p><code>
617       ProxyBlock *
618     </code></p></div>
619
620     <p>blocks connections to all sites.</p>
621
622 </div>
623 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
624 <div class="directive-section"><h2><a name="ProxyDomain" id="ProxyDomain">ProxyDomain</a> <a name="proxydomain" id="proxydomain">Directive</a></h2>
625 <table class="directive">
626 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default domain name for proxied requests</td></tr>
627 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyDomain <var>Domain</var></code></td></tr>
628 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
629 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
630 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
631 </table>
632     <p>This directive is only useful for Apache proxy servers within
633     intranets. The <code class="directive">ProxyDomain</code> directive specifies
634     the default domain which the apache proxy server will belong to. If a
635     request to a host without a domain name is encountered, a redirection
636     response to the same host with the configured <var>Domain</var> appended
637     will be generated.</p>
638
639     <div class="example"><h3>Example</h3><p><code>
640       ProxyRemote  *  http://firewall.mycompany.com:81<br />
641       NoProxy         .mycompany.com 192.168.112.0/21<br />
642       ProxyDomain     .mycompany.com
643     </code></p></div>
644
645 </div>
646 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
647 <div class="directive-section"><h2><a name="ProxyErrorOverride" id="ProxyErrorOverride">ProxyErrorOverride</a> <a name="proxyerroroverride" id="proxyerroroverride">Directive</a></h2>
648 <table class="directive">
649 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Override error pages for proxied content</td></tr>
650 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyErrorOverride On|Off</code></td></tr>
651 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyErrorOverride Off</code></td></tr>
652 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
653 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
654 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
655 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0 and later</td></tr>
656 </table>
657     <p>This directive is useful for reverse-proxy setups, where you want to 
658     have a common look and feel on the error pages seen by the end user. 
659     This also allows for included files (via
660     <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>'s SSI) to get
661     the error code and act accordingly (default behavior would display
662     the error page of the proxied server, turning this on shows the SSI
663     Error message).</p>
664
665 </div>
666 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
667 <div class="directive-section"><h2><a name="ProxyIOBufferSize" id="ProxyIOBufferSize">ProxyIOBufferSize</a> <a name="proxyiobuffersize" id="proxyiobuffersize">Directive</a></h2>
668 <table class="directive">
669 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine size of internal data throughput buffer</td></tr>
670 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyIOBufferSize <var>bytes</var></code></td></tr>
671 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyIOBufferSize 8192</code></td></tr>
672 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
673 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
674 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
675 </table>
676     <p>The <code class="directive">ProxyIOBufferSize</code> directive adjusts the size
677     of the internal buffer, which is used as a scratchpad for the data between
678     input and output. The size must be less or equal <code>8192</code>.</p>
679
680     <p>In almost every case there's no reason to change that value.</p>
681
682 </div>
683 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
684 <div class="directive-section"><h2><a name="ProxyMatch" id="ProxyMatch">&lt;ProxyMatch&gt;</a> <a name="proxymatch" id="proxymatch">Directive</a></h2>
685 <table class="directive">
686 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Container for directives applied to regular-expression-matched 
687 proxied resources</td></tr>
688 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>&lt;ProxyMatch <var>regex</var>&gt; ...&lt;/ProxyMatch&gt;</code></td></tr>
689 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
690 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
691 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
692 </table>
693     <p>The <code class="directive">&lt;ProxyMatch&gt;</code> directive is
694     identical to the <code class="directive"><a href="#proxy">&lt;Proxy&gt;</a></code> directive, except it matches URLs
695     using regular expressions.</p>
696
697 </div>
698 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
699 <div class="directive-section"><h2><a name="ProxyMaxForwards" id="ProxyMaxForwards">ProxyMaxForwards</a> <a name="proxymaxforwards" id="proxymaxforwards">Directive</a></h2>
700 <table class="directive">
701 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximium number of proxies that a request can be forwarded
702 through</td></tr>
703 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyMaxForwards <var>number</var></code></td></tr>
704 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyMaxForwards 10</code></td></tr>
705 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
706 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
707 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
708 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0 and later</td></tr>
709 </table>
710     <p>The <code class="directive">ProxyMaxForwards</code> directive specifies the
711     maximum number of proxies through which a request may pass, if there's no
712     <code>Max-Forwards</code> header supplied with the request. This is
713     set to prevent infinite proxy loops, or a DoS attack.</p>
714
715     <div class="example"><h3>Example</h3><p><code>
716       ProxyMaxForwards 15
717     </code></p></div>
718
719 </div>
720 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
721 <div class="directive-section"><h2><a name="ProxyPass" id="ProxyPass">ProxyPass</a> <a name="proxypass" id="proxypass">Directive</a></h2>
722 <table class="directive">
723 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps remote servers into the local server URL-space</td></tr>
724 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPass [<var>path</var>] !|<var>url</var> [<var>key=value</var> <var>key=value</var> ...]]</code></td></tr>
725 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
726 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
727 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
728 </table>
729     <p>This directive allows remote servers to be mapped into the space of
730     the local server; the local server does not act as a proxy in the
731     conventional sense, but appears to be a mirror of the remote
732     server. <var>path</var> is the name of a local virtual path; <var>url</var>
733     is a partial URL for the remote server and cannot include a query
734     string.</p>
735
736     <div class="warning">The <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> directive should
737     usually be set <strong>off</strong> when using
738     <code class="directive">ProxyPass</code>.</div>
739
740     <p>Suppose the local server has address <code>http://example.com/</code>;
741     then</p>
742
743     <div class="example"><p><code>
744       ProxyPass /mirror/foo/ http://backend.example.com/
745     </code></p></div>
746
747     <p>will cause a local request for
748     <code>http://example.com/mirror/foo/bar</code> to be internally converted
749     into a proxy request to <code>http://backend.example.com/bar</code>.</p>
750
751     <p>The <code>!</code> directive is useful in situations where you don't want
752     to reverse-proxy a subdirectory, <em>e.g.</em></p>
753
754     <div class="example"><p><code>
755       ProxyPass /mirror/foo/i !<br />
756       ProxyPass /mirror/foo http://backend.example.com
757     </code></p></div>
758
759     <p>will proxy all requests to <code>/mirror/foo</code> to
760     <code>backend.example.com</code> <em>except</em> requests made to
761     <code>/mirror/foo/i</code>.</p>
762
763     <div class="note"><h3>Note</h3>
764       <p>Order is important. you need to put the exclusions <em>before</em> the
765       general <code class="directive">ProxyPass</code> directive.</p>
766     </div>
767
768     <p>New in Apache 2.1, is the ability to use pooled connections to a 
769     backend server. Using the <code>key=value</code> parameters it is possible
770     to tune this connection pooling. The default for a <code>Hard Maximum</code>
771     for the number of connections is the number of threads per process in the 
772     active MPM. In the Prefork MPM, this is always 1, while with the Worker MPM
773     it is controlled by the <code class="directive">ThreadsPerChild</code>.</p>
774
775     <p>Setting <code>min</code> will determine how many connections will always 
776     be open to the backend server. Upto the Soft Maximum or <code>smax</code> 
777     number of connections will be created on demand. Any connections above 
778     <code>smax</code> are subject to a time to live or <code>ttl</code>.  Apache
779     will never create more than the Hard Maximum or <code>max</code> connections
780     to the backend server.</p>
781
782     <div class="example"><p><code>
783         ProxyPass /example http://backend.example.com smax=5 max=20 ttl=120 retry=300
784     </code></p></div>
785
786     <table>
787     <tr><th>Parameter</th>
788         <th>Default</th>
789         <th>Description</th></tr>
790     <tr><td>min</td>
791         <td>0</td>
792         <td>Minumum number of connections that will always
793             be open to the backend server.</td></tr>
794     <tr><td>max</td>
795         <td>1...n</td>
796         <td>Hard Maximum number of connections that will be
797     allowed to the backend server. The default for a Hard Maximum
798     for the number of connections is the number of threads per process in the 
799     active MPM. In the Prefork MPM, this is always 1, while with the Worker MPM
800     it is controlled by the <code class="directive">ThreadsPerChild</code>.
801     Apache will never create more than the Hard Maximum connections
802     to the backend server.</td></tr>
803     <tr><td>smax</td>
804         <td>max</td>
805         <td>Upto the Soft Maximum
806     number of connections will be created on demand. Any connections above 
807     <code>smax</code> are subject to a time to live or <code>ttl</code>.
808     </td></tr>
809     <tr><td>ttl</td>
810         <td>-</td>
811         <td>Time To Live for the inactive connections above the
812         <code>smax</code> connections in seconds. Apache will close all
813         connections that has not been used inside that time period.
814     </td></tr>
815     <tr><td>timeout</td>
816         <td><code class="directive">Timeout</code></td>
817         <td>Connection timeout in seconds.
818         If not set the Apache will wait until the free connection
819         is available. This directive is used for limiting the number
820         of connections to the backend server together with <code>max</code>
821         parameter.
822     </td></tr>
823     <tr><td>acquire</td>
824         <td>-</td>
825         <td>If set this will be the maximum time to wait for a free
826     connection in the connection pool. If there are no free connections
827     in the pool the Apache will return <code>SERVER_BUSY</code> status to
828     the client.
829     </td></tr>
830     <tr><td>keepalive</td>
831         <td>Off</td>
832         <td>This parameter should be used when you have a firewall between your
833     Apache and the backend server, who tend to drop inactive connections.
834     This flag will tell the Operating System to send <code>KEEP_ALIVE</code>
835     messages on inactive connections (interval depends on global OS settings,
836     generally 120ms), and thus prevent the firewall to drop the connection.
837     To enable keepalive set this property value to <code>On</code>. 
838     </td></tr>
839     <tr><td>retry</td>
840         <td>60</td>
841         <td>Connection pool worker retry timeout in seconds.
842     If the connection pool worker to the backend server is in the error state,
843     Apache will not forward any requests to that server until the timeout
844     expires. This enables to shut down the backend server for maintenance,
845     and bring it back online later.
846     </td></tr>
847     <tr><td>loadfactor</td>
848         <td>1</td>
849         <td>Worker load factor. Used with BalancerMember.
850          It is a number between 1 and 100 and defines the normalized weighted
851          load applied to the worker.
852     </td></tr>
853     <tr><td>route</td>
854         <td>-</td>
855         <td>Route of the worker when used inside load balancer.
856         The route is a value appended to seesion id.
857     </td></tr>
858     <tr><td>redirect</td>
859         <td>-</td>
860         <td>Redirection Route of the worker. This value is usually
861         set dynamically to enable safe removal of the node from
862         the cluster. If set all requests without session id will be
863         redirected to the BalancerMember that has route parametar
864         equal as this value.
865     </td></tr>
866
867     </table>
868
869     <p>If the Proxy directive scheme starts with the
870     <code>balancer://</code> then a virtual worker that does not really
871     communicate with the backend server will be created. Instead it is responsible
872     for the management of several "real" workers. In that case the special set of
873     parameters can be add to this virtual worker.
874     </p>
875     <table>
876     <tr><th>Parameter</th>
877         <th>Default</th>
878         <th>Description</th></tr>
879     <tr><td>lbmethod</td>
880         <td>-</td>
881         <td>Balancer load-balance method. Select the load-balancing scheduler
882         method to use. Either <code>requests</code>, to perform weighted
883         request counting or <code>traffic</code>, to perform weighted
884         traffic byte count balancing. Default is <code>requests</code>.
885     </td></tr>
886     <tr><td>stickysession</td>
887         <td>-</td>
888         <td>Balancer sticky session name. The value is usually set to something
889         like <code>JSESSIONID</code> or <code>PHPSESSIONID</code>,
890         and it depends on the backend application server that support sessions.
891     </td></tr>
892     <tr><td>nofailover</td>
893         <td>Off</td>
894         <td>If set to <code>On</code> the session will break if the worker is in
895         error state or disabled. Set this value to On if backend servers do not
896         support session replication.
897     </td></tr>
898     <tr><td>timeout</td>
899         <td>0</td>
900         <td>Balancer timeout in seconds. If set this will be the maximum time
901         to wait for a free worker. Default is not to wait. 
902     </td></tr>
903     <tr><td>maxattempts</td>
904         <td>1</td>
905         <td>Maximum number of failover attempts before giving up. 
906     </td></tr>
907     
908     </table>
909     <div class="example"><p><code>
910       ProxyPass /special-area http://special.example.com/ smax=5 max=10<br />
911       ProxyPass / balancer://mycluster stickysession=jsessionid nofailover=On<br />
912       &lt;Proxy balancer://mycluster&gt;<br />
913       <span class="indent">
914         BalancerMember http://1.2.3.4:8009<br />
915         BalancerMember http://1.2.3.5:8009 smax=10<br />
916         # Less powerful server, don't send as many requests there<br />
917         BalancerMember http://1.2.3.6:8009 smax=1 loadfactor=20<br />
918       </span>
919       &lt;/Proxy&gt;
920     </code></p></div>
921     
922     <p>When used inside a <code class="directive"><a href="../mod/core.html#location">&lt;Location&gt;</a></code> section, the first argument is omitted and the local
923     directory is obtained from the <code class="directive"><a href="../mod/core.html#location">&lt;Location&gt;</a></code>.</p>
924
925     <p>If you require a more flexible reverse-proxy configuration, see the
926     <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> directive with the
927     <code>[P]</code> flag.</p>
928
929 </div>
930 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
931 <div class="directive-section"><h2><a name="ProxyPassReverse" id="ProxyPassReverse">ProxyPassReverse</a> <a name="proxypassreverse" id="proxypassreverse">Directive</a></h2>
932 <table class="directive">
933 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Adjusts the URL in HTTP response headers sent from a reverse
934 proxied server</td></tr>
935 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassReverse [<var>path</var>] <var>url</var></code></td></tr>
936 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
937 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
938 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
939 </table>
940     <p>This directive lets Apache adjust the URL in the <code>Location</code>,
941     <code>Content-Location</code> and <code>URI</code> headers on HTTP redirect
942     responses. This is essential when Apache is used as a reverse proxy to avoid
943     by-passing the reverse proxy because of HTTP redirects on the backend
944     servers which stay behind the reverse proxy.</p>
945
946     <p>Only the HTTP response headers specifically mentioned above
947     will be rewritten.  Apache will not rewrite other response
948     headers, nor will it rewrite URL references inside HTML pages.
949     This means that if the proxied content contains absolute URL
950     references, they will by-pass the proxy.  A third-party module
951     that will look inside the HTML and rewrite URL references is Nick
952     Kew's <a href="http://apache.webthing.com/mod_proxy_html/">mod_proxy_html</a>.</p>
953
954     <p><var>path</var> is the name of a local virtual path. <var>url</var> is a
955     partial URL for the remote server - the same way they are used for the
956     <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive.</p>
957
958     <p>For example, suppose the local server has address
959     <code>http://example.com/</code>; then</p>
960
961     <div class="example"><p><code>
962       ProxyPass         /mirror/foo/ http://backend.example.com/<br />
963       ProxyPassReverse  /mirror/foo/ http://backend.example.com/<br />
964       ProxyPassReverseCookieDomain  backend.example.com  public.example.com<br />
965       ProxyPassReverseCookiePath  /  /mirror/foo/
966     </code></p></div>
967
968     <p>will not only cause a local request for the
969     <code>http://example.com/mirror/foo/bar</code> to be internally converted
970     into a proxy request to <code>http://backend.example.com/bar</code>
971     (the functionality <code>ProxyPass</code> provides here). It also takes care
972     of redirects the server <code>backend.example.com</code> sends: when
973     <code>http://backend.example.com/bar</code> is redirected by him to
974     <code>http://backend.example.com/quux</code> Apache adjusts this to
975     <code>http://example.com/mirror/foo/quux</code> before forwarding the HTTP
976     redirect response to the client. Note that the hostname used for
977     constructing the URL is chosen in respect to the setting of the <code class="directive"><a href="../mod/core.html#usecanonicalname">UseCanonicalName</a></code> directive.</p>
978
979     <p>Note that this <code class="directive">ProxyPassReverse</code> directive can
980     also be used in conjunction with the proxy pass-through feature
981     (<code>RewriteRule ...  [P]</code>) from <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
982     because it doesn't depend on a corresponding <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive.</p>
983
984     <p>When used inside a <code class="directive"><a href="../mod/core.html#location">&lt;Location&gt;</a></code> section, the first argument is omitted and the local
985     directory is obtained from the <code class="directive"><a href="../mod/core.html#location">&lt;Location&gt;</a></code>.</p>
986
987 </div>
988 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
989 <div class="directive-section"><h2><a name="ProxyPassReverseCookieDomain" id="ProxyPassReverseCookieDomain">ProxyPassReverseCookieDomain</a> <a name="proxypassreversecookiedomain" id="proxypassreversecookiedomain">Directive</a></h2>
990 <table class="directive">
991 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Adjusts the Domain string in Set-Cookie headers from a reverse-
992 proxied server</td></tr>
993 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassReverseCookieDomain <var>internal-domain</var> <var>public-domain</var></code></td></tr>
994 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
995 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
996 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
997 </table>
998 <p>Usage is basically similar to
999 <code class="directive"><a href="#proxypassreverse">ProxyPassReverse</a></code>, but instead of
1000 rewriting headers that are a URL, this rewrites the <code>domain</code>
1001 string in <code>Set-Cookie</code> headers.</p>
1002
1003 </div>
1004 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1005 <div class="directive-section"><h2><a name="ProxyPassReverseCookiePath" id="ProxyPassReverseCookiePath">ProxyPassReverseCookiePath</a> <a name="proxypassreversecookiepath" id="proxypassreversecookiepath">Directive</a></h2>
1006 <table class="directive">
1007 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Adjusts the Path string in Set-Cookie headers from a reverse-
1008 proxied server</td></tr>
1009 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassReverseCookiePath <var>internal-path</var> <var>public-path</var></code></td></tr>
1010 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1011 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1012 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1013 </table>
1014 <p>Usage is basically similar to
1015 <code class="directive"><a href="#proxypassreverse">ProxyPassReverse</a></code>, but instead of
1016 rewriting headers that are a URL, this rewrites the <code>path</code>
1017 string in <code>Set-Cookie</code> headers.</p>
1018
1019 </div>
1020 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1021 <div class="directive-section"><h2><a name="ProxyPreserveHost" id="ProxyPreserveHost">ProxyPreserveHost</a> <a name="proxypreservehost" id="proxypreservehost">Directive</a></h2>
1022 <table class="directive">
1023 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use incoming Host HTTP request header for proxy
1024 request</td></tr>
1025 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPreserveHost On|Off</code></td></tr>
1026 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyPreserveHost Off</code></td></tr>
1027 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1028 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1029 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1030 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.31 and later.</td></tr>
1031 </table>
1032     <p>When enabled, this option will pass the Host: line from the incoming
1033     request to the proxied host, instead of the hostname specified in the
1034     <code class="directive">ProxyPass</code> line.</p>
1035
1036     <p>This option should normally be turned <code>Off</code>. It is mostly 
1037     useful in special configurations like proxied mass name-based virtual
1038     hosting, where the original Host header needs to be evaluated by the
1039     backend server.</p>
1040
1041 </div>
1042 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1043 <div class="directive-section"><h2><a name="ProxyReceiveBufferSize" id="ProxyReceiveBufferSize">ProxyReceiveBufferSize</a> <a name="proxyreceivebuffersize" id="proxyreceivebuffersize">Directive</a></h2>
1044 <table class="directive">
1045 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Network buffer size for proxied HTTP and FTP
1046 connections</td></tr>
1047 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyReceiveBufferSize <var>bytes</var></code></td></tr>
1048 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyReceiveBufferSize 0</code></td></tr>
1049 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1050 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1051 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1052 </table>
1053     <p>The <code class="directive">ProxyReceiveBufferSize</code> directive specifies an
1054     explicit (TCP/IP) network buffer size for proxied HTTP and FTP connections,
1055     for increased throughput. It has to be greater than <code>512</code> or set
1056     to <code>0</code> to indicate that the system's default buffer size should
1057     be used.</p>
1058
1059     <div class="example"><h3>Example</h3><p><code>
1060       ProxyReceiveBufferSize 2048
1061     </code></p></div>
1062
1063 </div>
1064 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1065 <div class="directive-section"><h2><a name="ProxyRemote" id="ProxyRemote">ProxyRemote</a> <a name="proxyremote" id="proxyremote">Directive</a></h2>
1066 <table class="directive">
1067 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Remote proxy used to handle certain requests</td></tr>
1068 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyRemote <var>match</var> <var>remote-server</var></code></td></tr>
1069 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1070 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1071 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1072 </table>
1073     <p>This defines remote proxies to this proxy. <var>match</var> is either the
1074     name of a URL-scheme that the remote server supports, or a partial URL
1075     for which the remote server should be used, or <code>*</code> to indicate
1076     the server should be contacted for all requests. <var>remote-server</var> is
1077     a partial URL for the remote server. Syntax:</p>
1078
1079     <div class="example"><p><code>
1080       <dfn>remote-server</dfn> =
1081           <var>scheme</var>://<var>hostname</var>[:<var>port</var>]
1082     </code></p></div>
1083
1084     <p><var>scheme</var> is effectively the protocol that should be used to
1085     communicate with the remote server; only <code>http</code> is supported by
1086     this module.</p>
1087
1088     <div class="example"><h3>Example</h3><p><code>
1089       ProxyRemote http://goodguys.com/ http://mirrorguys.com:8000<br />
1090       ProxyRemote * http://cleversite.com<br />
1091       ProxyRemote ftp http://ftpproxy.mydomain.com:8080
1092     </code></p></div>
1093
1094     <p>In the last example, the proxy will forward FTP requests, encapsulated
1095     as yet another HTTP proxy request, to another proxy which can handle
1096     them.</p>
1097
1098     <p>This option also supports reverse proxy configuration - a backend
1099     webserver can be embedded within a virtualhost URL space even if that
1100     server is hidden by another forward proxy.</p>
1101
1102 </div>
1103 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1104 <div class="directive-section"><h2><a name="ProxyRemoteMatch" id="ProxyRemoteMatch">ProxyRemoteMatch</a> <a name="proxyremotematch" id="proxyremotematch">Directive</a></h2>
1105 <table class="directive">
1106 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Remote proxy used to handle requests matched by regular
1107 expressions</td></tr>
1108 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyRemoteMatch <var>regex</var> <var>remote-server</var></code></td></tr>
1109 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1110 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1111 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1112 </table>
1113     <p>The <code class="directive">ProxyRemoteMatch</code> is identical to the
1114     <code class="directive"><a href="#proxyremote">ProxyRemote</a></code> directive, except the
1115     first argument is a regular expression match against the requested URL.</p>
1116
1117 </div>
1118 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1119 <div class="directive-section"><h2><a name="ProxyRequests" id="ProxyRequests">ProxyRequests</a> <a name="proxyrequests" id="proxyrequests">Directive</a></h2>
1120 <table class="directive">
1121 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables forward (standard) proxy requests</td></tr>
1122 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyRequests On|Off</code></td></tr>
1123 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyRequests Off</code></td></tr>
1124 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1125 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1126 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1127 </table>
1128     <p>This allows or prevents Apache from functioning as a forward proxy
1129     server. (Setting ProxyRequests to <code>Off</code> does not disable use of
1130     the <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive.)</p>
1131
1132     <p>In a typical reverse proxy configuration, this option should be set to
1133     <code>Off</code>.</p>
1134
1135     <p>In order to get the functionality of proxying HTTP or FTP sites, you
1136     need also <code class="module"><a href="../mod/mod_proxy_http.html">mod_proxy_http</a></code> or <code class="module"><a href="../mod/mod_proxy_ftp.html">mod_proxy_ftp</a></code>
1137     (or both) present in the server.</p>
1138
1139     <div class="warning"><h3>Warning</h3>
1140       <p>Do not enable proxying with <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> until you have <a href="#access">secured your server</a>.  Open proxy servers are dangerous
1141       both to your network and to the Internet at large.</p>
1142     </div>
1143
1144 </div>
1145 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1146 <div class="directive-section"><h2><a name="ProxyTimeout" id="ProxyTimeout">ProxyTimeout</a> <a name="proxytimeout" id="proxytimeout">Directive</a></h2>
1147 <table class="directive">
1148 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Network timeout for proxied requests</td></tr>
1149 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyTimeout <var>seconds</var></code></td></tr>
1150 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyTimeout 300</code></td></tr>
1151 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1152 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1153 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1154 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.31 and later</td></tr>
1155 </table>
1156     <p>This directive allows a user to specifiy a timeout on proxy requests.
1157     This is useful when you have a slow/buggy appserver which hangs, and you
1158     would rather just return a timeout and fail gracefully instead of waiting
1159     however long it takes the server to return.</p>
1160
1161 </div>
1162 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1163 <div class="directive-section"><h2><a name="ProxyVia" id="ProxyVia">ProxyVia</a> <a name="proxyvia" id="proxyvia">Directive</a></h2>
1164 <table class="directive">
1165 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Information provided in the <code>Via</code> HTTP response
1166 header for proxied requests</td></tr>
1167 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyVia On|Off|Full|Block</code></td></tr>
1168 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyVia Off</code></td></tr>
1169 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1170 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1171 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1172 </table>
1173     <p>This directive controls the use of the <code>Via:</code> HTTP
1174     header by the proxy. Its intended use is to control the flow of
1175     proxy requests along a chain of proxy servers.  See <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> (HTTP/1.1), section
1176     14.45 for an explanation of <code>Via:</code> header lines.</p>
1177
1178     <ul>
1179     <li>If set to <code>Off</code>, which is the default, no special processing
1180     is performed. If a request or reply contains a <code>Via:</code> header,
1181     it is passed through unchanged.</li>
1182
1183     <li>If set to <code>On</code>, each request and reply will get a
1184     <code>Via:</code> header line added for the current host.</li>
1185
1186     <li>If set to <code>Full</code>, each generated <code>Via:</code> header
1187     line will additionally have the Apache server version shown as a
1188     <code>Via:</code> comment field.</li>
1189
1190     <li>If set to <code>Block</code>, every proxy request will have all its
1191     <code>Via:</code> header lines removed. No new <code>Via:</code> header will
1192     be generated.</li>
1193     </ul>
1194
1195 </div>
1196 </div>
1197 <div class="bottomlang">
1198 <p><span>Available Languages: </span><a href="../en/mod/mod_proxy.html" title="English">&nbsp;en&nbsp;</a> |
1199 <a href="../ja/mod/mod_proxy.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
1200 </div><div id="footer">
1201 <p class="apache">Copyright 1995-2005 The Apache Software Foundation or its licensors, as applicable.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
1202 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>
1203 </body></html>