]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_proxy.xml
7992b37f3805dd57f5c8c10b334ab53b8240ab8c
[apache] / docs / manual / mod / mod_proxy.xml
1 <?xml version="1.0"?>
2 <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
3 <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
4 <!-- $LastChangedRevision$ -->
5
6 <!--
7  Licensed to the Apache Software Foundation (ASF) under one or more
8  contributor license agreements.  See the NOTICE file distributed with
9  this work for additional information regarding copyright ownership.
10  The ASF licenses this file to You under the Apache License, Version 2.0
11  (the "License"); you may not use this file except in compliance with
12  the License.  You may obtain a copy of the License at
13
14      http://www.apache.org/licenses/LICENSE-2.0
15
16  Unless required by applicable law or agreed to in writing, software
17  distributed under the License is distributed on an "AS IS" BASIS,
18  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  See the License for the specific language governing permissions and
20  limitations under the License.
21 -->
22
23 <modulesynopsis metafile="mod_proxy.xml.meta">
24
25 <name>mod_proxy</name>
26 <description>HTTP/1.1 proxy/gateway server</description>
27 <status>Extension</status>
28 <sourcefile>mod_proxy.c</sourcefile>
29 <identifier>proxy_module</identifier>
30
31 <summary>
32     <note type="warning"><title>Warning</title>
33       <p>Do not enable proxying with <directive module="mod_proxy"
34       >ProxyRequests</directive> until you have <a href="#access"
35       >secured your server</a>. Open proxy servers are dangerous both to your
36       network and to the Internet at large.</p>
37     </note>
38
39     <p>This module implements a proxy/gateway for Apache. It implements
40     proxying capability for <code>AJP13</code> (Apache JServe Protocol
41     version 1.3), <code>FTP</code>, <code>CONNECT</code> (for SSL),
42     <code>HTTP/0.9</code>, <code>HTTP/1.0</code>, and <code>HTTP/1.1</code>.
43     The module can be configured to connect to other proxy modules for these
44     and other protocols.</p>
45
46     <p>Apache's proxy features are divided into several modules in
47     addition to <module>mod_proxy</module>:
48     <module>mod_proxy_http</module>, <module>mod_proxy_ftp</module>,
49     <module>mod_proxy_ajp</module>, <module>mod_proxy_balancer</module>,
50     and <module>mod_proxy_connect</module>.  Thus, if you want to use
51     one or more of the particular proxy functions, load
52     <module>mod_proxy</module> <em>and</em> the appropriate module(s)
53     into the server (either statically at compile-time or dynamically
54     via the <directive module="mod_so">LoadModule</directive>
55     directive).</p>
56
57     <p>In addition, extended features are provided by other modules.
58     Caching is provided by <module>mod_cache</module> and related
59     modules.  The ability to contact remote servers using the SSL/TLS
60     protocol is provided by the <code>SSLProxy*</code> directives of
61     <module>mod_ssl</module>.  These additional modules will need
62     to be loaded and configured to take advantage of these features.</p>
63 </summary>
64 <seealso><module>mod_cache</module></seealso>
65 <seealso><module>mod_proxy_http</module></seealso>
66 <seealso><module>mod_proxy_ftp</module></seealso>
67 <seealso><module>mod_proxy_connect</module></seealso>
68 <seealso><module>mod_proxy_balancer</module></seealso>
69 <seealso><module>mod_ssl</module></seealso>
70
71     <section id="forwardreverse"><title>Forward Proxies and Reverse 
72        Proxies/Gateways</title>
73       <p>Apache can be configured in both a <dfn>forward</dfn> and
74       <dfn>reverse</dfn> proxy (also known as <dfn>gateway</dfn>) mode.</p>
75
76       <p>An ordinary <dfn>forward proxy</dfn> is an intermediate
77       server that sits between the client and the <em>origin
78       server</em>.  In order to get content from the origin server,
79       the client sends a request to the proxy naming the origin server
80       as the target and the proxy then requests the content from the
81       origin server and returns it to the client.  The client must be
82       specially configured to use the forward proxy to access other
83       sites.</p>
84
85       <p>A typical usage of a forward proxy is to provide Internet
86       access to internal clients that are otherwise restricted by a
87       firewall.  The forward proxy can also use caching (as provided
88       by <module>mod_cache</module>) to reduce network usage.</p>
89
90       <p>The forward proxy is activated using the <directive
91       module="mod_proxy">ProxyRequests</directive> directive.  Because
92       forward proxies allow clients to access arbitrary sites through
93       your server and to hide their true origin, it is essential that
94       you <a href="#access">secure your server</a> so that only
95       authorized clients can access the proxy before activating a
96       forward proxy.</p>
97
98       <p>A <dfn>reverse proxy</dfn> (or <dfn>gateway</dfn>), by
99       contrast, appears to the client just like an ordinary web
100       server.  No special configuration on the client is necessary.
101       The client makes ordinary requests for content in the name-space
102       of the reverse proxy.  The reverse proxy then decides where to
103       send those requests, and returns the content as if it was itself
104       the origin.</p>
105
106       <p>A typical usage of a reverse proxy is to provide Internet
107       users access to a server that is behind a firewall.  Reverse
108       proxies can also be used to balance load among several back-end
109       servers, or to provide caching for a slower back-end server.
110       In addition, reverse proxies can be used simply to bring
111       several servers into the same URL space.</p>
112
113       <p>A reverse proxy is activated using the <directive
114       module="mod_proxy">ProxyPass</directive> directive or the
115       <code>[P]</code> flag to the <directive
116       module="mod_rewrite">RewriteRule</directive> directive.  It is
117       <strong>not</strong> necessary to turn <directive
118       module="mod_proxy">ProxyRequests</directive> on in order to
119       configure a reverse proxy.</p>
120     </section> <!-- /forwardreverse -->
121
122     <section id="examples"><title>Basic Examples</title>
123
124     <p>The examples below are only a very basic idea to help you
125     get started.  Please read the documentation on the individual
126     directives.</p>
127
128     <p>In addition, if you wish to have caching enabled, consult
129     the documentation from <module>mod_cache</module>.</p>
130
131     <example><title>Forward Proxy</title>
132     ProxyRequests On<br />
133     ProxyVia On<br />
134     <br />
135     &lt;Proxy *&gt;<br />
136     <indent>
137       Order deny,allow<br />
138       Deny from all<br />
139       Allow from internal.example.com<br />
140     </indent>
141     &lt;/Proxy&gt;
142     </example>
143
144     <example><title>Reverse Proxy</title>
145     ProxyRequests Off<br />
146     <br />
147     &lt;Proxy *&gt;<br />
148     <indent>
149       Order deny,allow<br />
150       Allow from all<br />
151     </indent>
152     &lt;/Proxy&gt;<br />
153     <br />
154     ProxyPass /foo http://foo.example.com/bar<br />
155     ProxyPassReverse /foo http://foo.example.com/bar
156     </example>
157     </section> <!-- /examples -->
158
159
160     <section id="access"><title>Controlling access to your proxy</title>
161       <p>You can control who can access your proxy via the <directive
162       module="mod_proxy" type="section">Proxy</directive> control block as in
163       the following example:</p>
164
165       <example>
166         &lt;Proxy *&gt;<br />
167         <indent>
168           Order Deny,Allow<br />
169           Deny from all<br />
170           Allow from 192.168.0<br />
171         </indent>
172         &lt;/Proxy&gt;
173       </example>
174
175       <p>For more information on access control directives, see
176       <module>mod_authz_host</module>.</p>
177
178       <p>Strictly limiting access is essential if you are using a
179       forward proxy (using the <directive
180       module="mod_proxy">ProxyRequests</directive> directive).
181       Otherwise, your server can be used by any client to access
182       arbitrary hosts while hiding his or her true identity.  This is
183       dangerous both for your network and for the Internet at large.
184       When using a reverse proxy (using the <directive
185       module="mod_proxy">ProxyPass</directive> directive with
186       <code>ProxyRequests Off</code>), access control is less
187       critical because clients can only contact the hosts that you
188       have specifically configured.</p>
189
190       <p><strong>See Also</strong> the <a href="mod_proxy_http.html#env"
191       >Proxy-Chain-Auth</a> environment variable.</p>
192
193     </section> <!-- /access -->
194
195     <section id="startup"><title>Slow Startup</title>
196       <p>If you're using the <directive module="mod_proxy"
197       >ProxyBlock</directive> directive, hostnames' IP addresses are looked up
198       and cached during startup for later match test. This may take a few
199       seconds (or more) depending on the speed with which the hostname lookups
200       occur.</p>
201     </section> <!-- /startup -->
202
203     <section id="intranet"><title>Intranet Proxy</title>
204       <p>An Apache proxy server situated in an intranet needs to forward
205       external requests through the company's firewall (for this, configure
206       the <directive module="mod_proxy">ProxyRemote</directive> directive
207       to forward the respective <var>scheme</var> to the firewall proxy).
208       However, when it has to
209       access resources within the intranet, it can bypass the firewall when
210       accessing hosts. The <directive module="mod_proxy">NoProxy</directive>
211       directive is useful for specifying which hosts belong to the intranet and
212       should be accessed directly.</p>
213
214       <p>Users within an intranet tend to omit the local domain name from their
215       WWW requests, thus requesting "http://somehost/" instead of
216       <code>http://somehost.example.com/</code>. Some commercial proxy servers
217       let them get away with this and simply serve the request, implying a
218       configured local domain. When the <directive module="mod_proxy"
219       >ProxyDomain</directive> directive is used and the server is <a
220       href="#proxyrequests">configured for proxy service</a>, Apache can return
221       a redirect response and send the client to the correct, fully qualified,
222       server address. This is the preferred method since the user's bookmark
223       files will then contain fully qualified hosts.</p>
224     </section> <!-- /intranet -->
225
226     <section id="envsettings"><title>Protocol Adjustments</title>
227       <p>For circumstances where <module>mod_proxy</module> is sending
228       requests to an origin server that doesn't properly implement
229       keepalives or HTTP/1.1, there are two <a
230       href="../env.html">environment variables</a> that can force the
231       request to use HTTP/1.0 with no keepalive. These are set via the
232       <directive module="mod_env">SetEnv</directive> directive.</p>
233
234       <p>These are the <code>force-proxy-request-1.0</code> and
235       <code>proxy-nokeepalive</code> notes.</p>
236
237       <example>
238         &lt;Location /buggyappserver/&gt;<br />
239         <indent>
240           ProxyPass http://buggyappserver:7001/foo/<br />
241           SetEnv force-proxy-request-1.0 1<br />
242           SetEnv proxy-nokeepalive 1<br />
243         </indent>
244         &lt;/Location&gt;
245       </example>
246
247     </section> <!-- /envsettings -->
248
249     <section id="request-bodies"><title>Request Bodies</title>
250
251     <p>Some request methods such as POST include a request body.
252     The HTTP protocol requires that requests which include a body
253     either use chunked transfer encoding or send a
254     <code>Content-Length</code> request header.  When passing these
255     requests on to the origin server, <module>mod_proxy_http</module>
256     will always attempt to send the <code>Content-Length</code>.  But
257     if the body is large and the original request used chunked
258     encoding, then chunked encoding may also be used in the upstream
259     request.  You can control this selection using <a
260     href="../env.html">environment variables</a>.  Setting
261     <code>proxy-sendcl</code> ensures maximum compatibility with
262     upstream servers by always sending the
263     <code>Content-Length</code>, while setting
264     <code>proxy-sendchunked</code> minimizes resource usage by using
265     chunked encoding.</p>
266
267     </section> <!-- /request-bodies -->
268
269     <section id="x-headers"><title>Reverse Proxy Request Headers</title>
270
271     <p>When acting in a reverse-proxy mode (using the <directive
272     module="mod_proxy">ProxyPass</directive> directive, for example),
273     <module>mod_proxy_http</module> adds several request headers in
274     order to pass information to the origin server. These headers
275     are:</p>
276
277     <dl>
278       <dt><code>X-Forwarded-For</code></dt>
279       <dd>The IP address of the client.</dd>
280       <dt><code>X-Forwarded-Host</code></dt>
281       <dd>The original host requested by the client in the <code>Host</code> 
282        HTTP request header.</dd>
283       <dt><code>X-Forwarded-Server</code></dt>
284       <dd>The hostname of the proxy server.</dd>
285     </dl>
286
287     <p>Be careful when using these headers on the origin server, since
288     they will contain more than one (comma-separated) value if the
289     original request already contained one of these headers. For
290     example, you can use <code>%{X-Forwarded-For}i</code> in the log
291     format string of the origin server to log the original clients IP
292     address, but you may get more than one address if the request
293     passes through several proxies.</p>
294
295     <p>See also the <directive
296     module="mod_proxy">ProxyPreserveHost</directive> and <directive
297     module="mod_proxy">ProxyVia</directive> directives, which control
298     other request headers.</p>
299
300    </section> <!--/x-headers -->
301
302
303 <directivesynopsis type="section">
304 <name>Proxy</name>
305 <description>Container for directives applied to proxied resources</description>
306 <syntax>&lt;Proxy <var>wildcard-url</var>&gt; ...&lt;/Proxy&gt;</syntax>
307 <contextlist><context>server config</context><context>virtual host</context>
308 </contextlist>
309
310 <usage>
311     <p>Directives placed in <directive type="section">Proxy</directive>
312     sections apply only to matching proxied content.  Shell-style wildcards are
313     allowed.</p>
314
315     <p>For example, the following will allow only hosts in
316     <code>yournetwork.example.com</code> to access content via your proxy
317     server:</p>
318
319     <example>
320       &lt;Proxy *&gt;<br />
321       <indent>
322         Order Deny,Allow<br />
323         Deny from all<br />
324         Allow from yournetwork.example.com<br />
325       </indent>
326       &lt;/Proxy&gt;
327     </example>
328
329     <p>The following example will process all files in the <code>foo</code>
330     directory of <code>example.com</code> through the <code>INCLUDES</code>
331     filter when they are sent through the proxy server:</p>
332
333     <example>
334       &lt;Proxy http://example.com/foo/*&gt;<br />
335       <indent>
336         SetOutputFilter INCLUDES<br />
337       </indent>
338       &lt;/Proxy&gt;
339     </example>
340
341 </usage>
342 </directivesynopsis>
343
344 <directivesynopsis>
345 <name>ProxyBadHeader</name>
346 <description>Determines how to handle bad header lines in a
347 response</description>
348 <syntax>ProxyBadHeader IsError|Ignore|StartBody</syntax>
349 <default>ProxyBadHeader IsError</default>
350 <contextlist><context>server config</context><context>virtual host</context>
351 </contextlist>
352 <compatibility>Available in Apache 2.0.44 and later</compatibility>
353
354 <usage>
355     <p>The <directive>ProxyBadHeader</directive> directive determines the
356     behaviour of <module>mod_proxy</module> if it receives syntactically invalid
357     header lines (<em>i.e.</em> containing no colon). The following arguments
358     are possible:</p>
359
360     <dl>
361     <dt><code>IsError</code></dt>
362     <dd>Abort the request and end up with a 502 (Bad Gateway) response. This is
363     the default behaviour.</dd>
364
365     <dt><code>Ignore</code></dt>
366     <dd>Treat bad header lines as if they weren't sent.</dd>
367
368     <dt><code>StartBody</code></dt>
369     <dd>When receiving the first bad header line, finish reading the headers and
370     treat the remainder as body. This helps to work around buggy backend servers
371     which forget to insert an empty line between the headers and the body.</dd>
372     </dl>
373 </usage>
374 </directivesynopsis>
375
376 <directivesynopsis>
377 <name>ProxyFtpDirCharset</name>
378 <description>Define the character set for proxied FTP listings</description>
379 <syntax>ProxyFtpDirCharset <var>character set</var></syntax>
380 <default>ProxyFtpDirCharset ISO-8859-1</default>
381 <contextlist><context>server config</context><context>virtual host</context>
382 <context>directory</context></contextlist>
383 <compatibility>Available in Apache 2.2.7 and later</compatibility>
384
385 <usage>
386     <p>The <directive>ProxyFtpDirCharset</directive> directive defines the
387     character set to be set for FTP directory listings in HTML generated by
388     <module>mod_proxy_ftp</module>.</p>
389 </usage>
390 </directivesynopsis>
391
392 <directivesynopsis type="section">
393 <name>ProxyMatch</name>
394 <description>Container for directives applied to regular-expression-matched 
395 proxied resources</description>
396 <syntax>&lt;ProxyMatch <var>regex</var>&gt; ...&lt;/ProxyMatch&gt;</syntax>
397 <contextlist><context>server config</context><context>virtual host</context>
398 </contextlist>
399
400 <usage>
401     <p>The <directive type="section">ProxyMatch</directive> directive is
402     identical to the <directive module="mod_proxy"
403     type="section">Proxy</directive> directive, except it matches URLs
404     using <glossary ref="regex">regular expressions</glossary>.</p>
405 </usage>
406 </directivesynopsis>
407
408 <directivesynopsis>
409 <name>ProxyPreserveHost</name>
410 <description>Use incoming Host HTTP request header for proxy
411 request</description>
412 <syntax>ProxyPreserveHost On|Off</syntax>
413 <default>ProxyPreserveHost Off</default>
414 <contextlist><context>server config</context><context>virtual host</context>
415 </contextlist>
416 <compatibility>Available in Apache 2.0.31 and later.</compatibility>
417
418 <usage>
419     <p>When enabled, this option will pass the Host: line from the incoming
420     request to the proxied host, instead of the hostname specified in the
421     <directive>ProxyPass</directive> line.</p>
422
423     <p>This option should normally be turned <code>Off</code>. It is mostly 
424     useful in special configurations like proxied mass name-based virtual
425     hosting, where the original Host header needs to be evaluated by the
426     backend server.</p>
427 </usage>
428 </directivesynopsis>
429
430 <directivesynopsis>
431 <name>ProxyRequests</name>
432 <description>Enables forward (standard) proxy requests</description>
433 <syntax>ProxyRequests On|Off</syntax>
434 <default>ProxyRequests Off</default>
435 <contextlist><context>server config</context><context>virtual host</context>
436 </contextlist>
437
438 <usage>
439     <p>This allows or prevents Apache from functioning as a forward proxy
440     server. (Setting ProxyRequests to <code>Off</code> does not disable use of
441     the <directive module="mod_proxy">ProxyPass</directive> directive.)</p>
442
443     <p>In a typical reverse proxy or gateway configuration, this
444     option should be set to
445     <code>Off</code>.</p>
446
447     <p>In order to get the functionality of proxying HTTP or FTP sites, you
448     need also <module>mod_proxy_http</module> or <module>mod_proxy_ftp</module>
449     (or both) present in the server.</p>
450
451     <note type="warning"><title>Warning</title>
452       <p>Do not enable proxying with <directive
453       module="mod_proxy">ProxyRequests</directive> until you have <a
454       href="#access">secured your server</a>.  Open proxy servers are dangerous
455       both to your network and to the Internet at large.</p>
456     </note>
457 </usage>
458 <seealso><a href="#forwardreverse">Forward and Reverse Proxies/Gateways</a></seealso>
459 </directivesynopsis>
460
461 <directivesynopsis>
462 <name>ProxyRemote</name>
463 <description>Remote proxy used to handle certain requests</description>
464 <syntax>ProxyRemote <var>match</var> <var>remote-server</var></syntax>
465 <contextlist><context>server config</context><context>virtual host</context>
466 </contextlist>
467
468 <usage>
469     <p>This defines remote proxies to this proxy. <var>match</var> is either the
470     name of a URL-scheme that the remote server supports, or a partial URL
471     for which the remote server should be used, or <code>*</code> to indicate
472     the server should be contacted for all requests. <var>remote-server</var> is
473     a partial URL for the remote server. Syntax:</p>
474
475     <example>
476       <dfn>remote-server</dfn> =
477           <var>scheme</var>://<var>hostname</var>[:<var>port</var>]
478     </example>
479
480     <p><var>scheme</var> is effectively the protocol that should be used to
481     communicate with the remote server; only <code>http</code> is supported by
482     this module.</p>
483
484     <example><title>Example</title>
485       ProxyRemote http://goodguys.example.com/ http://mirrorguys.example.com:8000<br />
486       ProxyRemote * http://cleverproxy.localdomain<br />
487       ProxyRemote ftp http://ftpproxy.mydomain:8080
488     </example>
489
490     <p>In the last example, the proxy will forward FTP requests, encapsulated
491     as yet another HTTP proxy request, to another proxy which can handle
492     them.</p>
493
494     <p>This option also supports reverse proxy configuration - a backend
495     webserver can be embedded within a virtualhost URL space even if that
496     server is hidden by another forward proxy.</p>
497 </usage>
498 </directivesynopsis>
499
500 <directivesynopsis>
501 <name>ProxyRemoteMatch</name>
502 <description>Remote proxy used to handle requests matched by regular
503 expressions</description>
504 <syntax>ProxyRemoteMatch <var>regex</var> <var>remote-server</var></syntax>
505 <contextlist><context>server config</context><context>virtual host</context>
506 </contextlist>
507
508 <usage>
509     <p>The <directive>ProxyRemoteMatch</directive> is identical to the
510     <directive module="mod_proxy">ProxyRemote</directive> directive, except the
511     first argument is a <glossary ref="regex">regular expression</glossary>
512     match against the requested URL.</p>
513 </usage>
514 </directivesynopsis>
515
516 <directivesynopsis>
517 <name>BalancerMember</name>
518 <description>Add a member to a load balancing group</description>
519 <syntax>BalancerMember <var>url</var> [<var
520   >key=value [key=value ...]]</var></syntax>
521 <contextlist><context>directory</context>
522 </contextlist>
523 <compatibility>BalancerMember is only available in Apache 2.2
524   and later.</compatibility>
525 <usage>
526     <p>This directive adds a member to a load balancing group. It must be used
527     within a <code>&lt;Proxy <var>balancer://</var>...&gt;</code> container
528     directive, and can take any of the parameters available to
529     <directive module="mod_proxy">ProxyPass</directive> directives.</p>
530     <p>One additional parameter is available only to <directive
531     module="mod_proxy">BalancerMember</directive> directives:
532     <var>loadfactor</var>. This is the member load factor - a number between 1 
533     (default) and 100, which defines the weighted load to be applied to the 
534     member in question.</p>
535 </usage>
536 </directivesynopsis>
537
538 <directivesynopsis>
539 <name>ProxySet</name>
540 <description>Set various Proxy balancer or member parameters</description>
541 <syntax>ProxySet <var>url</var> <var>key=value [key=value ...]</var></syntax>
542 <contextlist><context>directory</context>
543 </contextlist>
544 <compatibility>ProxySet is only available in Apache 2.2
545   and later.</compatibility>
546 <usage>
547     <p>This directive is used as an alternate method of setting any of the
548     parameters available to Proxy balancers and workers normally done via the
549     <directive module="mod_proxy">ProxyPass</directive> directive. If used
550     within a <code>&lt;Proxy <var>balancer url|worker url</var>&gt;</code>
551     container directive, the <var>url</var> argument is not required. As a side
552     effect the respective balancer or worker gets created. This can be useful
553     when doing reverse proxying via a
554     <directive module="mod_rewrite">RewriteRule</directive> instead of a
555     <directive module="mod_proxy">ProxyPass</directive> directive.</p>
556
557     <example>
558       &lt;Proxy balancer://hotcluster&gt;<br />
559       <indent>
560         BalancerMember http://www2.example.com:8009 loadfactor=1<br />
561         BalancerMember http://www3.example.com:8009 loadfactor=2<br />
562         ProxySet lbmethod=bytraffic<br />
563       </indent>
564       &lt;/Proxy&gt;
565     </example>
566
567     <example>
568       &lt;Proxy http://backend&gt;<br />
569       <indent>
570         ProxySet keepalive=On<br />
571       </indent>
572       &lt;/Proxy&gt;
573     </example>
574
575     <example>
576         ProxySet balancer://foo lbmethod=bytraffic timeout=15
577     </example>
578
579     <example>
580         ProxySet ajp://backend:7001 timeout=15
581     </example>
582
583    <note type="warning"><title>Warning</title>
584       <p>Keep in mind that the same parameter key can have a different meaning
585       depending whether it is applied to a balancer or a worker as shown by the two
586       examples above regarding timeout.</p>
587    </note>
588
589 </usage>
590 </directivesynopsis>
591
592 <directivesynopsis>
593 <name>ProxyPass</name>
594 <description>Maps remote servers into the local server URL-space</description>
595 <syntax>ProxyPass [<var>path</var>] !|<var>url</var> [<var>key=value</var>
596   <var>[key=value</var> ...]] [nocanon] [interpolate]</syntax>
597 <contextlist><context>server config</context><context>virtual host</context>
598 <context>directory</context>
599 </contextlist>
600
601 <usage>
602     <p>This directive allows remote servers to be mapped into the
603     space of the local server; the local server does not act as a
604     proxy in the conventional sense, but appears to be a mirror of the
605     remote server. The local server is often called a <dfn>reverse
606     proxy</dfn> or <dfn>gateway</dfn>. The <var>path</var> is the name of
607     a local virtual path; <var>url</var> is a partial URL for the
608     remote server and cannot include a query string.</p>
609
610     <note type="warning">The <directive
611     module="mod_proxy">ProxyRequests</directive> directive should
612     usually be set <strong>off</strong> when using
613     <directive>ProxyPass</directive>.</note>
614
615     <p>Suppose the local server has address <code>http://example.com/</code>;
616     then</p>
617
618     <example>
619       ProxyPass /mirror/foo/ http://backend.example.com/
620     </example>
621
622     <p>will cause a local request for
623     <code>http://example.com/mirror/foo/bar</code> to be internally converted
624     into a proxy request to <code>http://backend.example.com/bar</code>.</p>
625
626     <note type="warning">
627     <p>If the first argument ends with a trailing <strong>/</strong>, the second
628        argument should also end with a trailing <strong>/</strong> and vice
629        versa. Otherwise the resulting requests to the backend may miss some
630        needed slashes and do not deliver the expected results.
631     </p>
632     </note>
633
634     <p>The <code>!</code> directive is useful in situations where you don't want
635     to reverse-proxy a subdirectory, <em>e.g.</em></p>
636
637     <example>
638       ProxyPass /mirror/foo/i !<br />
639       ProxyPass /mirror/foo http://backend.example.com
640     </example>
641
642     <p>will proxy all requests to <code>/mirror/foo</code> to
643     <code>backend.example.com</code> <em>except</em> requests made to
644     <code>/mirror/foo/i</code>.</p>
645
646     <note><title>Note</title>
647       <p>Order is important: exclusions must come <em>before</em> the
648       general <directive>ProxyPass</directive> directive.</p>
649     </note>
650
651     <p>As of Apache 2.1, the ability to use pooled connections to a backend
652     server is available. Using the <code>key=value</code> parameters it is
653     possible to tune this connection pooling. The default for a <code>Hard
654     Maximum</code> for the number of connections is the number of threads per
655     process in the active MPM. In the Prefork MPM, this is always 1, while with
656     the Worker MPM it is controlled by the
657     <directive>ThreadsPerChild</directive>.</p>
658
659     <p>Setting <code>min</code> will determine how many connections will always 
660     be open to the backend server. Upto the Soft Maximum or <code>smax</code> 
661     number of connections will be created on demand. Any connections above 
662     <code>smax</code> are subject to a time to live or <code>ttl</code>.  Apache
663     will never create more than the Hard Maximum or <code>max</code> connections
664     to the backend server.</p>
665
666     <example>
667         ProxyPass /example http://backend.example.com smax=5 max=20 ttl=120 retry=300
668     </example>
669
670     <table>
671     <tr><th>Parameter</th>
672         <th>Default</th>
673         <th>Description</th></tr>
674     <tr><td>min</td>
675         <td>0</td>
676         <td>Minimum number of connections that will always
677             be open to the backend server.</td></tr>
678     <tr><td>max</td>
679         <td>1...n</td>
680         <td>Hard Maximum number of connections that will be
681     allowed to the backend server. The default for a Hard Maximum
682     for the number of connections is the number of threads per process in the 
683     active MPM. In the Prefork MPM, this is always 1, while with the Worker MPM
684     it is controlled by the <directive>ThreadsPerChild</directive>.
685     Apache will never create more than the Hard Maximum connections
686     to the backend server.</td></tr>
687     <tr><td>smax</td>
688         <td>max</td>
689         <td>Upto the Soft Maximum
690     number of connections will be created on demand. Any connections above 
691     <code>smax</code> are subject to a time to live or <code>ttl</code>.
692     </td></tr>
693     <tr><td>acquire</td>
694         <td>-</td>
695         <td>If set this will be the maximum time to wait for a free
696     connection in the connection pool, in milliseconds. If there are no free
697     connections in the pool the Apache will return <code>SERVER_BUSY</code>
698     status to the client.
699     </td></tr>
700     <tr><td>connectiontimeout</td>
701         <td>timeout</td>
702         <td>Connect timeout in seconds.
703         The number of seconds Apache waits for the creation of a connection to
704         the backend to complete. By adding a postfix of ms the timeout can be
705         also set in milliseconds.
706     </td></tr>
707     <tr><td>disablereuse</td>
708         <td>Off</td>
709         <td>This parameter should be used when you want to force mod_proxy
710     to immediately close a connection to the backend after being used, and
711     thus, disable its persistent connection and pool for that backend.
712     This helps in various situations where a firewall between Apache and
713     the backend server (regardless of protocol) tends to silently
714     drop connections or when backends themselves may be under round-
715     robin DNS. To disable connection pooling reuse,
716     set this property value to <code>On</code>. 
717     </td></tr>
718     <tr><td>flushpackets</td>
719         <td>off</td>
720         <td>Determines whether the proxy module will auto-flush the output
721         brigade after each "chunk" of data. 'off' means that it will flush
722         only when needed, 'on' means after each chunk is sent and
723         'auto' means poll/wait for a period of time and flush if
724         no input has been received for 'flushwait' milliseconds.
725         Currently this is in effect only for AJP.
726     </td></tr>
727     <tr><td>flushwait</td>
728         <td>10</td>
729         <td>The time to wait for additional input, in milliseconds, before
730         flushing the output brigade if 'flushpackets' is 'auto'.
731     </td></tr>
732     <tr><td>keepalive</td>
733         <td>Off</td>
734         <td>This parameter should be used when you have a firewall between your
735     Apache and the backend server, who tend to drop inactive connections.
736     This flag will tell the Operating System to send <code>KEEP_ALIVE</code>
737     messages on inactive connections (interval depends on global OS settings,
738     generally 120ms), and thus prevent the firewall to drop the connection.
739     To enable keepalive set this property value to <code>On</code>. 
740     </td></tr>
741     <tr><td>lbset</td>
742         <td>0</td>
743         <td>Sets the load balancer cluster set that the worker is a member
744          of. The load balancer will try all members of a lower numbered
745          lbset before trying higher numbered ones.
746     </td></tr>
747     <tr><td>ping</td>
748         <td>0</td>
749         <td>Ping property tells webserver to send a <code>CPING</code>
750         request on ajp13 connection before forwarding a request.
751         The parameter is the delay in seconds to wait for the
752         <code>CPONG</code> reply.
753         This features has been added to avoid problem with hung and
754         busy Tomcat's and require ajp13 ping/pong support which has
755         been implemented on Tomcat 3.3.2+, 4.1.28+ and 5.0.13+.
756         This will increase the network traffic during the normal operation
757         which could be an issue, but it will lower the
758         traffic in case some of the cluster nodes are down or busy.
759         Currently this has an effect only for AJP.
760         By adding a postfix of ms the delay can be also set in
761         milliseconds.
762     </td></tr>
763     <tr><td>redirect</td>
764         <td>-</td>
765         <td>Redirection Route of the worker. This value is usually
766         set dynamically to enable safe removal of the node from
767         the cluster. If set all requests without session id will be
768         redirected to the BalancerMember that has route parametar
769         equal as this value.
770     </td></tr>
771     <tr><td>retry</td>
772         <td>60</td>
773         <td>Connection pool worker retry timeout in seconds.
774     If the connection pool worker to the backend server is in the error state,
775     Apache will not forward any requests to that server until the timeout
776     expires. This enables to shut down the backend server for maintenance,
777     and bring it back online later. A value of 0 means always retry workers
778     in an error state with no timeout.
779     </td></tr>
780     <tr><td>route</td>
781         <td>-</td>
782         <td>Route of the worker when used inside load balancer.
783         The route is a value appended to session id.
784     </td></tr>
785     <tr><td>status</td>
786         <td>-</td>
787         <td>Single letter value defining the initial status of
788         this worker: 'D' is disabled, 'S' is stopped, 'I' is ignore-errors,
789         'H' is hot-standby and 'E' is in an error state. Status 
790         can be set (which is the default) by prepending with '+' or 
791         cleared by prepending with '-'.
792         Thus, a setting of 'S-E' sets this worker to Stopped and
793         clears the in-error flag.
794     </td></tr>
795     <tr><td>timeout</td>
796         <td><directive module="mod_proxy">ProxyTimeout</directive></td>
797         <td>Connection timeout in seconds.
798         The number of seconds Apache waits for data sent by / to the backend.
799     </td></tr>
800     <tr><td>ttl</td>
801         <td>-</td>
802         <td>Time To Live for the inactive connections above the
803         <code>smax</code> connections in seconds. Apache will close all
804         connections that has not been used inside that time period.
805     </td></tr>
806
807     </table>
808
809     <p>If the Proxy directive scheme starts with the
810     <code>balancer://</code> then a virtual worker that does not really
811     communicate with the backend server will be created. Instead it is responsible
812     for the management of several "real" workers. In that case the special set of
813     parameters can be add to this virtual worker. See <module>mod_proxy_balancer</module>
814     for more information about how the balancer works.
815     </p>
816     <table>
817     <tr><th>Parameter</th>
818         <th>Default</th>
819         <th>Description</th></tr>
820     <tr><td>lbmethod</td>
821         <td>byrequests</td>
822         <td>Balancer load-balance method. Select the load-balancing scheduler
823         method to use. Either <code>byrequests</code>, to perform weighted
824         request counting, <code>bytraffic</code>, to perform weighted
825         traffic byte count balancing, or <code>bybusyness</code>, to perform 
826         pending request balancing. Default is <code>byrequests</code>.
827     </td></tr>
828     <tr><td>maxattempts</td>
829         <td>1</td>
830         <td>Maximum number of failover attempts before giving up. 
831     </td></tr>
832     <tr><td>nofailover</td>
833         <td>Off</td>
834         <td>If set to <code>On</code> the session will break if the worker is in
835         error state or disabled. Set this value to On if backend servers do not
836         support session replication.
837     </td></tr>
838     <tr><td>stickysession</td>
839         <td>-</td>
840         <td>Balancer sticky session name. The value is usually set to something
841         like <code>JSESSIONID</code> or <code>PHPSESSIONID</code>,
842         and it depends on the backend application server that support sessions.
843         If the backend application server uses different name for cookies
844         and url encoded id (like servlet containers) use | to to separate them.
845         The first part is for the cookie the second for the path.
846     </td></tr>
847     <tr><td>scolonpathdelim</td>
848         <td>Off</td>
849         <td>If set to <code>On</code> the semi-colon character ';' will be
850         used as an additional sticky session path deliminator/separator. This
851         is mainly used to emulate mod_jk's behavior when dealing with paths such
852         as <code>JSESSIONID=6736bcf34;foo=aabfa</code>
853     </td></tr>
854     <tr><td>timeout</td>
855         <td>0</td>
856         <td>Balancer timeout in seconds. If set this will be the maximum time
857         to wait for a free worker. Default is not to wait. 
858     </td></tr>
859     
860     </table>
861     <p>A sample balancer setup</p>
862     <example>
863       ProxyPass /special-area http://special.example.com/ smax=5 max=10<br />
864       ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=On<br />
865       &lt;Proxy balancer://mycluster&gt;<br />
866       <indent>
867         BalancerMember http://1.2.3.4:8009<br />
868         BalancerMember http://1.2.3.5:8009 smax=10<br />
869         # Less powerful server, don't send as many requests there<br />
870         BalancerMember http://1.2.3.6:8009 smax=1 loadfactor=20<br />
871       </indent>
872       &lt;/Proxy&gt;
873     </example>
874
875     <p>Setting up a hot-standby, that will only be used if no other
876      members are available</p>
877     <example>
878       ProxyPass / balancer://hotcluster/ <br />
879       &lt;Proxy balancer://hotcluster&gt;<br />
880       <indent>
881         BalancerMember http://1.2.3.4:8009 loadfactor=1<br />
882         BalancerMember http://1.2.3.5:8009 loadfactor=2<br />
883         # The below is the hot standby<br />
884         BalancerMember http://1.2.3.6:8009 status=+H<br />
885         ProxySet lbmethod=bytraffic
886       </indent>
887       &lt;/Proxy&gt;
888     </example>
889
890     <p>Normally, mod_proxy will canonicalise ProxyPassed URLs.
891     But this may be incompatible with some backends, particularly those
892     that make use of <var>PATH_INFO</var>.  The optional <var>nocanon</var>
893     keyword suppresses this, and passes the URL path "raw" to the
894     backend.  Note that may affect the security of your backend, as it
895     removes the normal limited protection against URL-based attacks
896     provided by the proxy.</p>
897
898     <p>The optional <var>interpolate</var> keyword (available in
899     httpd 2.2.9 and later), in combination with
900     <directive>ProxyPassInterpolateEnv</directive> causes the ProxyPass
901     to interpolate environment variables, using the syntax
902     <var>${VARNAME}</var>.  Note that many of the standard CGI-derived
903     environment variables will not exist when this interpolation happens,
904     so you may still have to resort to <module>mod_rewrite</module>
905     for complex rules.</p>
906
907     <p>When used inside a <directive type="section" module="core"
908     >Location</directive> section, the first argument is omitted and the local
909     directory is obtained from the <directive type="section" module="core"
910     >Location</directive>.</p>
911
912     <p>If you require a more flexible reverse-proxy configuration, see the
913     <directive module="mod_rewrite">RewriteRule</directive> directive with the
914     <code>[P]</code> flag.</p>
915 </usage>
916 </directivesynopsis>
917
918 <directivesynopsis>
919 <name>ProxyPassMatch</name>
920 <description>Maps remote servers into the local server URL-space using regular expressions</description>
921 <syntax>ProxyPassMatch [<var>regex</var>] !|<var>url</var> [<var>key=value</var>
922         <var>[key=value</var> ...]]</syntax>
923 <contextlist><context>server config</context><context>virtual host</context>
924 <context>directory</context>
925 </contextlist>
926
927 <usage>
928     <p>This directive is equivalent to <directive module="mod_proxy">ProxyPass</directive>,
929        but makes use of regular expressions, instead of simple prefix matching. The
930        supplied regular expression is matched against the <var>url</var>, and if it
931        matches, the server will substitute any parenthesized matches into the given
932        string and use it as a new <var>url</var>.</p>
933
934     <p>Suppose the local server has address <code>http://example.com/</code>;
935     then</p>
936
937     <example>
938       ProxyPassMatch ^(/.*\.gif)$ http://backend.example.com$1
939     </example>
940
941     <p>will cause a local request for
942     <code>http://example.com/foo/bar.gif</code> to be internally converted
943     into a proxy request to <code>http://backend.example.com/foo/bar.gif</code>.</p>
944
945     <p>The <code>!</code> directive is useful in situations where you don't want
946     to reverse-proxy a subdirectory.</p>
947 </usage>
948 </directivesynopsis>
949
950 <directivesynopsis>
951 <name>ProxyPassReverse</name>
952 <description>Adjusts the URL in HTTP response headers sent from a reverse
953 proxied server</description>
954 <syntax>ProxyPassReverse [<var>path</var>] <var>url</var>
955 [<var>interpolate</var>]</syntax>
956 <contextlist><context>server config</context><context>virtual host</context>
957 <context>directory</context>
958 </contextlist>
959
960 <usage>
961     <p>This directive lets Apache adjust the URL in the <code>Location</code>,
962     <code>Content-Location</code> and <code>URI</code> headers on HTTP
963     redirect responses. This is essential when Apache is used as a
964     reverse proxy (or gateway) to avoid by-passing the reverse proxy
965     because of HTTP redirects on the backend servers which stay behind
966     the reverse proxy.</p>
967
968     <p>Only the HTTP response headers specifically mentioned above
969     will be rewritten.  Apache will not rewrite other response
970     headers, nor will it rewrite URL references inside HTML pages.
971     This means that if the proxied content contains absolute URL
972     references, they will by-pass the proxy.  A third-party module
973     that will look inside the HTML and rewrite URL references is Nick
974     Kew's <a href="http://apache.webthing.com/mod_proxy_html/"
975     >mod_proxy_html</a>.</p>
976
977     <p><var>path</var> is the name of a local virtual path. <var>url</var> is a
978     partial URL for the remote server - the same way they are used for the
979     <directive module="mod_proxy">ProxyPass</directive> directive.</p>
980
981     <p>For example, suppose the local server has address
982     <code>http://example.com/</code>; then</p>
983
984     <example>
985       ProxyPass         /mirror/foo/ http://backend.example.com/<br />
986       ProxyPassReverse  /mirror/foo/ http://backend.example.com/<br />
987       ProxyPassReverseCookieDomain  backend.example.com  public.example.com<br />
988       ProxyPassReverseCookiePath  /  /mirror/foo/
989     </example>
990
991     <p>will not only cause a local request for the
992     <code>http://example.com/mirror/foo/bar</code> to be internally converted
993     into a proxy request to <code>http://backend.example.com/bar</code>
994     (the functionality <code>ProxyPass</code> provides here). It also takes care
995     of redirects the server <code>backend.example.com</code> sends: when
996     <code>http://backend.example.com/bar</code> is redirected by him to
997     <code>http://backend.example.com/quux</code> Apache adjusts this to
998     <code>http://example.com/mirror/foo/quux</code> before forwarding the HTTP
999     redirect response to the client. Note that the hostname used for
1000     constructing the URL is chosen in respect to the setting of the <directive
1001     module="core">UseCanonicalName</directive> directive.</p>
1002
1003     <p>Note that this <directive>ProxyPassReverse</directive> directive can
1004     also be used in conjunction with the proxy pass-through feature
1005     (<code>RewriteRule ...  [P]</code>) from <module>mod_rewrite</module>
1006     because it doesn't depend on a corresponding <directive module="mod_proxy"
1007     >ProxyPass</directive> directive.</p>
1008
1009     <p>The optional <var>interpolate</var> keyword (available in
1010     httpd 2.2.9 and later), used together with
1011     <directive>ProxyPassInterpolateEnv</directive>, enables interpolation
1012     of environment variables specified using the format <var>${VARNAME}</var>.
1013     </p>
1014
1015     <p>When used inside a <directive type="section" module="core"
1016     >Location</directive> section, the first argument is omitted and the local
1017     directory is obtained from the <directive type="section" module="core"
1018     >Location</directive>.</p>
1019 </usage>
1020 </directivesynopsis>
1021
1022 <directivesynopsis>
1023 <name>ProxyPassReverseCookieDomain</name>
1024 <description>Adjusts the Domain string in Set-Cookie headers from a reverse-
1025 proxied server</description>
1026 <syntax>ProxyPassReverseCookieDomain <var>internal-domain</var>
1027 <var>public-domain</var> [<var>interpolate</var>]</syntax>
1028 <contextlist><context>server config</context><context>virtual host</context>
1029 <context>directory</context>
1030 </contextlist>
1031 <usage>
1032 <p>Usage is basically similar to
1033 <directive module="mod_proxy">ProxyPassReverse</directive>, but instead of
1034 rewriting headers that are a URL, this rewrites the <code>domain</code>
1035 string in <code>Set-Cookie</code> headers.</p>
1036 </usage>
1037 </directivesynopsis>
1038 <directivesynopsis>
1039 <name>ProxyPassReverseCookiePath</name>
1040 <description>Adjusts the Path string in Set-Cookie headers from a reverse-
1041 proxied server</description>
1042 <syntax>ProxyPassReverseCookiePath <var>internal-path</var>
1043 <var>public-path</var> [<var>interpolate</var>]</syntax>
1044 <contextlist><context>server config</context><context>virtual host</context>
1045 <context>directory</context>
1046 </contextlist>
1047 <usage>
1048 <p>Usage is basically similar to
1049 <directive module="mod_proxy">ProxyPassReverse</directive>, but instead of
1050 rewriting headers that are a URL, this rewrites the <code>path</code>
1051 string in <code>Set-Cookie</code> headers.</p>
1052 </usage>
1053 </directivesynopsis>
1054
1055
1056 <directivesynopsis>
1057 <name>AllowCONNECT</name>
1058 <description>Ports that are allowed to <code>CONNECT</code> through the
1059 proxy</description>
1060 <syntax>AllowCONNECT <var>port</var> [<var>port</var>] ...</syntax>
1061 <default>AllowCONNECT 443 563</default>
1062 <contextlist><context>server config</context><context>virtual host</context>
1063 </contextlist>
1064
1065 <usage>
1066     <p>The <directive>AllowCONNECT</directive> directive specifies a list
1067     of port numbers to which the proxy <code>CONNECT</code> method may
1068     connect.  Today's browsers use this method when a <code>https</code>
1069     connection is requested and proxy tunneling over HTTP is in effect.</p>
1070
1071     <p>By default, only the default https port (<code>443</code>) and the
1072     default snews port (<code>563</code>) are enabled. Use the
1073     <directive>AllowCONNECT</directive> directive to override this default and
1074     allow connections to the listed ports only.</p>
1075
1076     <p>Note that you'll need to have <module>mod_proxy_connect</module> present
1077     in the server in order to get the support for the <code>CONNECT</code> at
1078     all.</p>
1079 </usage>
1080 </directivesynopsis>
1081
1082 <directivesynopsis>
1083 <name>ProxyBlock</name>
1084 <description>Words, hosts, or domains that are banned from being
1085 proxied</description>
1086 <syntax>ProxyBlock *|<var>word</var>|<var>host</var>|<var>domain</var>
1087 [<var>word</var>|<var>host</var>|<var>domain</var>] ...</syntax>
1088 <contextlist><context>server config</context><context>virtual host</context>
1089 </contextlist>
1090
1091 <usage>
1092     <p>The <directive>ProxyBlock</directive> directive specifies a list of
1093     words, hosts and/or domains, separated by spaces.  HTTP, HTTPS, and
1094     FTP document requests to sites whose names contain matched words,
1095     hosts or domains are <em>blocked</em> by the proxy server. The proxy
1096     module will also attempt to determine IP addresses of list items which
1097     may be hostnames during startup, and cache them for match test as
1098     well. That may slow down the startup time of the server.</p>
1099
1100     <example><title>Example</title>
1101       ProxyBlock joes-garage.com some-host.co.uk rocky.wotsamattau.edu
1102     </example>
1103
1104     <p><code>rocky.wotsamattau.edu</code> would also be matched if referenced by
1105     IP address.</p>
1106
1107     <p>Note that <code>wotsamattau</code> would also be sufficient to match
1108     <code>wotsamattau.edu</code>.</p>
1109
1110     <p>Note also that</p>
1111
1112     <example>
1113       ProxyBlock *
1114     </example>
1115
1116     <p>blocks connections to all sites.</p>
1117 </usage>
1118 </directivesynopsis>
1119
1120 <directivesynopsis>
1121 <name>ProxyReceiveBufferSize</name>
1122 <description>Network buffer size for proxied HTTP and FTP
1123 connections</description>
1124 <syntax>ProxyReceiveBufferSize <var>bytes</var></syntax>
1125 <default>ProxyReceiveBufferSize 0</default>
1126 <contextlist><context>server config</context><context>virtual host</context>
1127 </contextlist>
1128
1129 <usage>
1130     <p>The <directive>ProxyReceiveBufferSize</directive> directive specifies an
1131     explicit (TCP/IP) network buffer size for proxied HTTP and FTP connections,
1132     for increased throughput. It has to be greater than <code>512</code> or set
1133     to <code>0</code> to indicate that the system's default buffer size should
1134     be used.</p>
1135
1136     <example><title>Example</title>
1137       ProxyReceiveBufferSize 2048
1138     </example>
1139 </usage>
1140 </directivesynopsis>
1141
1142 <directivesynopsis>
1143 <name>ProxyIOBufferSize</name>
1144 <description>Determine size of internal data throughput buffer</description>
1145 <syntax>ProxyIOBufferSize <var>bytes</var></syntax>
1146 <default>ProxyIOBufferSize 8192</default>
1147 <contextlist><context>server config</context><context>virtual host</context>
1148 </contextlist>
1149
1150 <usage>
1151     <p>The <directive>ProxyIOBufferSize</directive> directive adjusts the size
1152     of the internal buffer, which is used as a scratchpad for the data between
1153     input and output. The size must be less or equal <code>65536</code>.</p>
1154
1155     <p>In almost every case there's no reason to change that value.</p>
1156     <p>If used with AJP this directive sets the maximum AJP packet size in
1157     bytes. If you change it from the default, you must also change the 
1158     <code>packetSize</code> attribute of your AJP connector on the
1159     Tomcat side! The attribute <code>packetSize</code> is only available
1160     in Tomcat <code>5.5.20+</code> and <code>6.0.2+</code></p>
1161     <p>Normally it is not necessary to change the maximum packet size.
1162     Problems with the default value have been reported when sending
1163     certificates or certificate chains.</p>
1164     
1165 </usage>
1166 </directivesynopsis>
1167
1168 <directivesynopsis>
1169 <name>ProxyMaxForwards</name>
1170 <description>Maximium number of proxies that a request can be forwarded
1171 through</description>
1172 <syntax>ProxyMaxForwards <var>number</var></syntax>
1173 <default>ProxyMaxForwards -1</default>
1174 <contextlist><context>server config</context><context>virtual host</context>
1175 </contextlist>
1176 <compatibility>Available in Apache 2.0 and later;
1177         default behaviour changed in 2.2.7/2.3</compatibility>
1178
1179 <usage>
1180     <p>The <directive>ProxyMaxForwards</directive> directive specifies the
1181     maximum number of proxies through which a request may pass, if there's no
1182     <code>Max-Forwards</code> header supplied with the request. This may
1183     be set to prevent infinite proxy loops, or a DoS attack.</p>
1184
1185     <example><title>Example</title>
1186       ProxyMaxForwards 15
1187     </example>
1188
1189     <p>Note that setting <directive>ProxyMaxForwards</directive> is a
1190     violation of the HTTP/1.1 protocol (RFC2616), which forbids a Proxy
1191     setting <code>Max-Forwards</code> if the Client didn't set it.
1192     Earlier Apache versions would always set it.  A negative
1193     <directive>ProxyMaxForwards</directive> value, including the
1194     default -1, gives you protocol-compliant behaviour, but may
1195     leave you open to loops.</p>
1196 </usage>
1197 </directivesynopsis>
1198
1199 <directivesynopsis>
1200 <name>NoProxy</name>
1201 <description>Hosts, domains, or networks that will be connected to
1202 directly</description>
1203 <syntax>NoProxy <var>host</var> [<var>host</var>] ...</syntax>
1204 <contextlist><context>server config</context><context>virtual host</context>
1205 </contextlist>
1206
1207 <usage>
1208     <p>This directive is only useful for Apache proxy servers within
1209     intranets.  The <directive>NoProxy</directive> directive specifies a
1210     list of subnets, IP addresses, hosts and/or domains, separated by
1211     spaces. A request to a host which matches one or more of these is
1212     always served directly, without forwarding to the configured
1213     <directive module="mod_proxy">ProxyRemote</directive> proxy server(s).</p>
1214
1215     <example><title>Example</title>
1216       ProxyRemote  *  http://firewall.example.com:81<br />
1217       NoProxy         .example.com 192.168.112.0/21
1218     </example>
1219
1220     <p>The <var>host</var> arguments to the <directive>NoProxy</directive>
1221     directive are one of the following type list:</p>
1222
1223     <dl>
1224     <!-- ===================== Domain ======================= -->
1225     <dt><var><a name="domain" id="domain">Domain</a></var></dt>
1226     <dd>
1227     <p>A <dfn>Domain</dfn> is a partially qualified DNS domain name, preceded
1228     by a period. It represents a list of hosts which logically belong to the
1229     same DNS domain or zone (<em>i.e.</em>, the suffixes of the hostnames are
1230     all ending in <var>Domain</var>).</p>
1231
1232     <example><title>Examples</title>
1233       .com .apache.org.
1234     </example>
1235
1236     <p>To distinguish <var>Domain</var>s from <var><a href="#hostname"
1237     >Hostname</a></var>s (both syntactically and semantically; a DNS domain can
1238     have a DNS A record, too!), <var>Domain</var>s are always written with a
1239     leading period.</p>
1240     
1241     <note><title>Note</title>
1242       <p>Domain name comparisons are done without regard to the case, and
1243       <var>Domain</var>s are always assumed to be anchored in the root of the
1244       DNS tree, therefore two domains <code>.ExAmple.com</code> and
1245       <code>.example.com.</code> (note the trailing period) are considered
1246       equal. Since a domain comparison does not involve a DNS lookup, it is much
1247       more efficient than subnet comparison.</p>
1248     </note></dd>
1249
1250     <!-- ===================== SubNet ======================= -->
1251     <dt><var><a name="subnet" id="subnet">SubNet</a></var></dt>
1252     <dd>
1253     <p>A <dfn>SubNet</dfn> is a partially qualified internet address in
1254     numeric (dotted quad) form, optionally followed by a slash and the netmask,
1255     specified as the number of significant bits in the <var>SubNet</var>. It is
1256     used to represent a subnet of hosts which can be reached over a common
1257     network interface. In the absence of the explicit net mask it is assumed
1258     that omitted (or zero valued) trailing digits specify the mask. (In this
1259     case, the netmask can only be multiples of 8 bits wide.) Examples:</p>
1260
1261     <dl>
1262     <dt><code>192.168</code> or <code>192.168.0.0</code></dt>
1263     <dd>the subnet 192.168.0.0 with an implied netmask of 16 valid bits
1264     (sometimes used in the netmask form <code>255.255.0.0</code>)</dd>
1265     <dt><code>192.168.112.0/21</code></dt>
1266     <dd>the subnet <code>192.168.112.0/21</code> with a netmask of 21
1267     valid bits (also used in the form <code>255.255.248.0</code>)</dd>
1268     </dl>
1269
1270     <p>As a degenerate case, a <em>SubNet</em> with 32 valid bits is the
1271     equivalent to an <var><a href="#ipadr">IPAddr</a></var>, while a <var>SubNet</var> with zero
1272     valid bits (<em>e.g.</em>, 0.0.0.0/0) is the same as the constant
1273     <var>_Default_</var>, matching any IP address.</p></dd>
1274
1275     <!-- ===================== IPAddr ======================= -->
1276     <dt><var><a name="ipaddr" id="ipaddr">IPAddr</a></var></dt>
1277     <dd>
1278     <p>A <dfn>IPAddr</dfn> represents a fully qualified internet address in
1279     numeric (dotted quad) form. Usually, this address represents a host, but
1280     there need not necessarily be a DNS domain name connected with the
1281     address.</p>
1282     <example><title>Example</title>
1283       192.168.123.7
1284     </example>
1285     
1286     <note><title>Note</title>
1287       <p>An <var>IPAddr</var> does not need to be resolved by the DNS system, so
1288       it can result in more effective apache performance.</p>
1289     </note></dd>
1290
1291     <!-- ===================== Hostname ======================= -->
1292     <dt><var><a name="hostname" id="hostname">Hostname</a></var></dt>
1293     <dd>
1294     <p>A <dfn>Hostname</dfn> is a fully qualified DNS domain name which can
1295     be resolved to one or more <var><a href="#ipaddr">IPAddrs</a></var> via the
1296     DNS domain name service. It represents a logical host (in contrast to
1297     <var><a href="#domain">Domain</a></var>s, see above) and must be resolvable
1298     to at least one <var><a href="#ipaddr">IPAddr</a></var> (or often to a list
1299     of hosts with different <var><a href="#ipaddr">IPAddr</a></var>s).</p>
1300
1301     <example><title>Examples</title>
1302       prep.ai.example.com<br />
1303       www.apache.org
1304     </example>
1305
1306     <note><title>Note</title>
1307       <p>In many situations, it is more effective to specify an <var><a
1308       href="#ipaddr">IPAddr</a></var> in place of a <var>Hostname</var> since a
1309       DNS lookup can be avoided. Name resolution in Apache can take a remarkable
1310       deal of time when the connection to the name server uses a slow PPP
1311       link.</p>
1312       <p><var>Hostname</var> comparisons are done without regard to the case,
1313       and <var>Hostname</var>s are always assumed to be anchored in the root
1314       of the DNS tree, therefore two hosts <code>WWW.ExAmple.com</code>
1315       and <code>www.example.com.</code> (note the trailing period) are
1316       considered equal.</p>
1317      </note></dd>
1318     </dl>
1319 </usage>
1320 <seealso><a href="../dns-caveats.html">DNS Issues</a></seealso>
1321 </directivesynopsis>
1322
1323 <directivesynopsis>
1324 <name>ProxyTimeout</name>
1325 <description>Network timeout for proxied requests</description>
1326 <syntax>ProxyTimeout <var>seconds</var></syntax>
1327 <default>Value of <directive module="core">Timeout</directive></default>
1328 <contextlist><context>server config</context><context>virtual host</context>
1329 </contextlist>
1330 <compatibility>Available in Apache 2.0.31 and later</compatibility>
1331
1332 <usage>
1333     <p>This directive allows a user to specifiy a timeout on proxy requests.
1334     This is useful when you have a slow/buggy appserver which hangs, and you
1335     would rather just return a timeout and fail gracefully instead of waiting
1336     however long it takes the server to return.</p>
1337 </usage>
1338 </directivesynopsis>
1339
1340 <directivesynopsis>
1341 <name>ProxyDomain</name>
1342 <description>Default domain name for proxied requests</description>
1343 <syntax>ProxyDomain <var>Domain</var></syntax>
1344 <contextlist><context>server config</context><context>virtual host</context>
1345 </contextlist>
1346
1347 <usage>
1348     <p>This directive is only useful for Apache proxy servers within
1349     intranets. The <directive>ProxyDomain</directive> directive specifies
1350     the default domain which the apache proxy server will belong to. If a
1351     request to a host without a domain name is encountered, a redirection
1352     response to the same host with the configured <var>Domain</var> appended
1353     will be generated.</p>
1354
1355     <example><title>Example</title>
1356       ProxyRemote  *  http://firewall.example.com:81<br />
1357       NoProxy         .example.com 192.168.112.0/21<br />
1358       ProxyDomain     .example.com
1359     </example>
1360 </usage>
1361 </directivesynopsis>
1362
1363 <directivesynopsis>
1364 <name>ProxyVia</name>
1365 <description>Information provided in the <code>Via</code> HTTP response
1366 header for proxied requests</description>
1367 <syntax>ProxyVia On|Off|Full|Block</syntax>
1368 <default>ProxyVia Off</default>
1369 <contextlist><context>server config</context><context>virtual host</context>
1370 </contextlist>
1371
1372 <usage>
1373     <p>This directive controls the use of the <code>Via:</code> HTTP
1374     header by the proxy. Its intended use is to control the flow of
1375     proxy requests along a chain of proxy servers.  See <a
1376     href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> (HTTP/1.1), section
1377     14.45 for an explanation of <code>Via:</code> header lines.</p>
1378
1379     <ul>
1380     <li>If set to <code>Off</code>, which is the default, no special processing
1381     is performed. If a request or reply contains a <code>Via:</code> header,
1382     it is passed through unchanged.</li>
1383
1384     <li>If set to <code>On</code>, each request and reply will get a
1385     <code>Via:</code> header line added for the current host.</li>
1386
1387     <li>If set to <code>Full</code>, each generated <code>Via:</code> header
1388     line will additionally have the Apache server version shown as a
1389     <code>Via:</code> comment field.</li>
1390
1391     <li>If set to <code>Block</code>, every proxy request will have all its
1392     <code>Via:</code> header lines removed. No new <code>Via:</code> header will
1393     be generated.</li>
1394     </ul>
1395 </usage>
1396 </directivesynopsis>
1397
1398 <directivesynopsis>
1399 <name>ProxyErrorOverride</name>
1400 <description>Override error pages for proxied content</description>
1401 <syntax>ProxyErrorOverride On|Off</syntax>
1402 <default>ProxyErrorOverride Off</default>
1403 <contextlist><context>server config</context><context>virtual host</context>
1404 </contextlist>
1405 <compatibility>Available in version 2.0 and later</compatibility>
1406
1407 <usage>
1408     <p>This directive is useful for reverse-proxy setups, where you want to 
1409     have a common look and feel on the error pages seen by the end user. 
1410     This also allows for included files (via
1411     <module>mod_include</module>'s SSI) to get
1412     the error code and act accordingly (default behavior would display
1413     the error page of the proxied server, turning this on shows the SSI
1414     Error message).</p>
1415
1416     <p>This directive does not affect the processing of informational (1xx),
1417     normal success (2xx), or redirect (3xx) responses.</p>
1418 </usage>
1419 </directivesynopsis>
1420
1421 <directivesynopsis>
1422 <name>ProxyPassInterpolateEnv</name>
1423 <description>Enable Environment Variable interpolation in Reverse Proxy configurations</description>
1424 <syntax>ProxyPassInterpolateEnv On|Off</syntax>
1425 <default>ProxyPassInterpolateEnv Off</default>
1426 <contextlist><context>server config</context>
1427 <context>virtual host</context>
1428 <context>directory</context>
1429 </contextlist>
1430 <compatibility>Available in httpd 2.2.9 and later</compatibility>
1431
1432 <usage>
1433     <p>This directive, together with the <var>interpolate</var> argument to
1434     <directive>ProxyPass</directive>, <directive>ProxyPassReverse</directive>,
1435     <directive>ProxyPassReverseCookieDomain</directive> and
1436     <directive>ProxyPassReverseCookiePath</directive>
1437     enables reverse proxies to be dynamically
1438     configured using environment variables, which may be set by
1439     another module such as <module>mod_rewrite</module>.
1440     It affects the <directive>ProxyPass</directive>,
1441     <directive>ProxyPassReverse</directive>,
1442     <directive>ProxyPassReverseCookieDomain</directive>, and
1443     <directive>ProxyPassReverseCookiePath</directive> directives,
1444     and causes them to substitute the value of an environment
1445     variable <code>varname</code> for the string <code>${varname}</code>
1446     in configuration directives.</p>
1447     <p>Keep this turned off (for server performance) unless you need it!</p>
1448 </usage>
1449 </directivesynopsis>
1450
1451 <directivesynopsis>
1452 <name>ProxyStatus</name>
1453 <description>Show Proxy LoadBalancer status in mod_status</description>
1454 <syntax>ProxyStatus Off|On|Full</syntax>
1455 <default>ProxyStatus Off</default>
1456 <contextlist><context>server config</context>
1457 <context>virtual host</context>
1458 </contextlist>
1459 <compatibility>Available in version 2.2 and later</compatibility>
1460
1461 <usage>
1462     <p>This directive determines whether or not proxy
1463     loadbalancer status data is displayed via the <module>mod_status</module>
1464     server-status page.</p>
1465     <note><title>Note</title>
1466       <p><strong>Full</strong> is synonymous with <strong>On</strong></p>
1467     </note>
1468
1469 </usage>
1470 </directivesynopsis>
1471
1472 </modulesynopsis>