]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_proxy.xml
Unified duplicate warning in mod_proxy ProxyPass documentation.
[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>Multi-protocol 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><module>mod_proxy</module> and related modules implement a
40     proxy/gateway for Apache HTTP Server, supporting a number of popular
41     protocols as well as several different load balancing algorithms.
42     Third-party modules can add support for additional protocols and
43     load balancing algorithms.</p>
44
45     <p>A set of modules must be loaded into the server to provide the
46     necessary features.  These modules can be included statically at
47     build time or dynamically via the
48     <directive module="mod_so">LoadModule</directive> directive).
49     The set must include:</p>
50
51     <ul>
52       <li><module>mod_proxy</module>, which provides basic proxy
53       capabilities</li>
54
55       <li><module>mod_proxy_balancer</module> and one or more
56       balancer modules if load balancing is required.  (See
57       <module>mod_proxy_balancer</module> for more information.)</li>
58
59       <li>one or more proxy scheme, or protocol, modules:
60
61         <table border="1">
62         <tr><th>Protocol</th><th>Module</th></tr>
63         <tr><td>AJP13 (Apache JServe Protocol version
64           1.3)</td><td><module>mod_proxy_ajp</module></td></tr>
65         <tr><td>CONNECT (for
66           SSL)</td><td><module>mod_proxy_connect</module></td></tr>
67         <tr><td>FastCGI</td><td><module>mod_proxy_fcgi</module></td></tr>
68         <tr><td>ftp</td><td><module>mod_proxy_ftp</module></td></tr>
69         <tr><td>HTTP/0.9, HTTP/1.0, and
70           HTTP/1.1</td><td><module>mod_proxy_http</module></td></tr>
71         <tr><td>SCGI</td><td><module>mod_proxy_scgi</module></td></tr>
72         <tr><td>WS and WSS (Web-sockets)</td><td><module>mod_proxy_wstunnel</module></td></tr>
73         </table>
74       </li>
75     </ul>
76
77     <p>In addition, extended features are provided by other modules.
78     Caching is provided by <module>mod_cache</module> and related
79     modules.  The ability to contact remote servers using the SSL/TLS
80     protocol is provided by the <code>SSLProxy*</code> directives of
81     <module>mod_ssl</module>.  These additional modules will need
82     to be loaded and configured to take advantage of these features.</p>
83 </summary>
84 <seealso><module>mod_cache</module></seealso>
85 <seealso><module>mod_proxy_ajp</module></seealso>
86 <seealso><module>mod_proxy_balancer</module></seealso>
87 <seealso><module>mod_proxy_connect</module></seealso>
88 <seealso><module>mod_proxy_fcgi</module></seealso>
89 <seealso><module>mod_proxy_ftp</module></seealso>
90 <seealso><module>mod_proxy_hcheck</module></seealso>
91 <seealso><module>mod_proxy_http</module></seealso>
92 <seealso><module>mod_proxy_scgi</module></seealso>
93 <seealso><module>mod_proxy_wstunnel</module></seealso>
94 <seealso><module>mod_ssl</module></seealso>
95
96     <section id="forwardreverse"><title>Forward Proxies and Reverse
97        Proxies/Gateways</title>
98       <p>Apache HTTP Server can be configured in both a <dfn>forward</dfn> and
99       <dfn>reverse</dfn> proxy (also known as <dfn>gateway</dfn>) mode.</p>
100
101       <p>An ordinary <dfn>forward proxy</dfn> is an intermediate
102       server that sits between the client and the <em>origin
103       server</em>.  In order to get content from the origin server,
104       the client sends a request to the proxy naming the origin server
105       as the target. The proxy then requests the content from the
106       origin server and returns it to the client.  The client must be
107       specially configured to use the forward proxy to access other
108       sites.</p>
109
110       <p>A typical usage of a forward proxy is to provide Internet
111       access to internal clients that are otherwise restricted by a
112       firewall.  The forward proxy can also use caching (as provided
113       by <module>mod_cache</module>) to reduce network usage.</p>
114
115       <p>The forward proxy is activated using the <directive
116       module="mod_proxy">ProxyRequests</directive> directive.  Because
117       forward proxies allow clients to access arbitrary sites through
118       your server and to hide their true origin, it is essential that
119       you <a href="#access">secure your server</a> so that only
120       authorized clients can access the proxy before activating a
121       forward proxy.</p>
122
123       <p>A <dfn>reverse proxy</dfn> (or <dfn>gateway</dfn>), by
124       contrast, appears to the client just like an ordinary web
125       server.  No special configuration on the client is necessary.
126       The client makes ordinary requests for content in the namespace
127       of the reverse proxy.  The reverse proxy then decides where to
128       send those requests and returns the content as if it were itself
129       the origin.</p>
130
131       <p>A typical usage of a reverse proxy is to provide Internet
132       users access to a server that is behind a firewall.  Reverse
133       proxies can also be used to balance load among several back-end
134       servers or to provide caching for a slower back-end server.
135       In addition, reverse proxies can be used simply to bring
136       several servers into the same URL space.</p>
137
138       <p>A reverse proxy is activated using the <directive
139       module="mod_proxy">ProxyPass</directive> directive or the
140       <code>[P]</code> flag to the <directive
141       module="mod_rewrite">RewriteRule</directive> directive.  It is
142       <strong>not</strong> necessary to turn <directive
143       module="mod_proxy">ProxyRequests</directive> on in order to
144       configure a reverse proxy.</p>
145     </section> <!-- /forwardreverse -->
146
147     <section id="examples"><title>Basic Examples</title>
148
149     <p>The examples below are only a very basic idea to help you
150     get started.  Please read the documentation on the individual
151     directives.</p>
152
153     <p>In addition, if you wish to have caching enabled, consult
154     the documentation from <module>mod_cache</module>.</p>
155
156     <example><title>Reverse Proxy</title>
157     <highlight language="config">
158 ProxyPass        "/foo" "http://foo.example.com/bar"
159 ProxyPassReverse "/foo" "http://foo.example.com/bar"
160     </highlight>
161     </example>
162
163     <example><title>Forward Proxy</title>
164     <highlight language="config">
165 ProxyRequests On
166 ProxyVia On
167
168 &lt;Proxy *&gt;
169   Require host internal.example.com
170 &lt;/Proxy&gt;
171     </highlight>
172     </example>
173     </section> <!-- /examples -->
174
175     <section id="handler"><title>Access via Handler</title>
176
177       <p>You can also force a request to be handled as a reverse-proxy
178         request, by creating a suitable Handler pass-through. The example
179         configuration below will pass all requests for PHP scripts to the
180         specified FastCGI server using reverse proxy:
181       </p>
182
183       <example><title>Reverse Proxy PHP scripts</title>
184       <highlight language="config">
185 &lt;FilesMatch "\.php$"&gt;
186     SetHandler  "proxy:unix:/path/to/app.sock|fcgi://localhost/"
187 &lt;/FilesMatch&gt;
188       </highlight>
189       </example>
190
191       <p>This feature is available in Apache HTTP Server 2.4.10 and later.</p>
192
193     </section> <!-- /handler -->
194
195     <section id="workers"><title>Workers</title>
196       <p>The proxy manages the configuration of origin servers and their
197       communication parameters in objects called <dfn>workers</dfn>.
198       There are two built-in workers: the default forward proxy worker and the
199       default reverse proxy worker. Additional workers can be configured
200       explicitly.</p>
201
202       <p>The two default workers have a fixed configuration
203       and will be used if no other worker matches the request.
204       They do not use HTTP Keep-Alive or connection pooling.
205       The TCP connections to the origin server will instead be
206       opened and closed for each request.</p>
207
208       <p>Explicitly configured workers are identified by their URL.
209       They are usually created and configured using
210       <directive module="mod_proxy">ProxyPass</directive> or
211       <directive module="mod_proxy">ProxyPassMatch</directive> when used
212       for a reverse proxy:</p>
213
214       <highlight language="config">
215 ProxyPass "/example" "http://backend.example.com" connectiontimeout=5 timeout=30
216       </highlight>
217
218       <p>This will create a worker associated with the origin server URL
219       <code>http://backend.example.com</code> that will use the given timeout
220       values. When used in a forward proxy, workers are usually defined
221       via the <directive module="mod_proxy">ProxySet</directive> directive:</p>
222
223       <highlight language="config">
224           ProxySet http://backend.example.com connectiontimeout=5 timeout=30
225       </highlight>
226
227       <p>or alternatively using <directive module="mod_proxy">Proxy</directive>
228       and <directive module="mod_proxy">ProxySet</directive>:</p>
229
230       <highlight language="config">
231 &lt;Proxy http://backend.example.com&gt;
232   ProxySet connectiontimeout=5 timeout=30
233 &lt;/Proxy&gt;
234       </highlight>
235
236       <p>Using explicitly configured workers in the forward mode is
237       not very common, because forward proxies usually communicate with many
238       different origin servers. Creating explicit workers for some of the
239       origin servers can still be useful if they are used very often.
240       Explicitly configured workers have no concept of forward or reverse
241       proxying by themselves. They encapsulate a common concept of
242       communication with origin servers. A worker created by
243       <directive module="mod_proxy">ProxyPass</directive> for use in a
244       reverse proxy will also be used for forward proxy requests whenever
245       the URL to the origin server matches the worker URL, and vice versa.</p>
246
247       <p>The URL identifying a direct worker is the URL of its
248       origin server including any path components given:</p>
249
250      <highlight language="config">
251 ProxyPass "/examples" "http://backend.example.com/examples"
252 ProxyPass "/docs"     "http://backend.example.com/docs"
253       </highlight>
254
255       <p>This example defines two different workers, each using a separate
256       connection pool and configuration.</p>
257
258       <note type="warning"><title>Worker Sharing</title>
259         <p>Worker sharing happens if the worker URLs overlap, which occurs when
260         the URL of some worker is a leading substring of the URL of another
261         worker defined later in the configuration file. In the following example</p>
262
263         <highlight language="config">
264 ProxyPass "/apps"     "http://backend.example.com/" timeout=60
265 ProxyPass "/examples" "http://backend.example.com/examples" timeout=10
266         </highlight>
267
268         <p>the second worker isn't actually created. Instead the first
269         worker is used. The benefit is, that there is only one connection pool,
270         so connections are more often reused. Note that all configuration attributes
271         given explicitly for the later worker will be ignored. This will be logged
272         as a warning. In the above example, the resulting timeout value
273         for the URL <code>/examples</code> will be <code>60</code> instead
274         of <code>10</code>!</p>
275
276         <p>If you want to avoid worker sharing, sort your worker definitions
277         by URL length, starting with the longest worker URLs. If you want to maximize
278         worker sharing, use the reverse sort order. See also the related warning about
279         ordering <directive module="mod_proxy">ProxyPass</directive> directives.</p>
280
281       </note> <!-- /worker_sharing -->
282
283       <p>Explicitly configured workers come in two flavors:
284       <dfn>direct workers</dfn> and <dfn>(load) balancer workers</dfn>.
285       They support many important configuration attributes which are
286       described below in the <directive module="mod_proxy">ProxyPass</directive>
287       directive. The same attributes can also be set using
288       <directive module="mod_proxy">ProxySet</directive>.</p>
289
290       <p>The set of options available for a direct worker
291       depends on the protocol which is specified in the origin server URL.
292       Available protocols include <code>ajp</code>, <code>fcgi</code>,
293       <code>ftp</code>, <code>http</code> and <code>scgi</code>.</p>
294
295       <p>Balancer workers are virtual workers that use direct workers known
296       as their members to actually handle the requests. Each balancer can
297       have multiple members. When it handles a request, it chooses a member
298       based on the configured load balancing algorithm.</p>
299
300       <p>A balancer worker is created if its worker URL uses
301       <code>balancer</code> as the protocol scheme.
302       The balancer URL uniquely identifies the balancer worker.
303       Members are added to a balancer using
304       <directive module="mod_proxy">BalancerMember</directive>.</p>
305
306       <note><title>DNS resolution for origin domains</title>
307       <p>DNS resolution happens when the socket to
308         the origin domain is created for the first time.
309         When connection pooling is used, each backend domain is resolved 
310         only once per child process, and reused for all further connections 
311         until the child is recycled. This information should to be considered 
312         while planning DNS maintenance tasks involving backend domains. 
313         Please also check <directive module="mod_proxy">ProxyPass</directive>
314         parameters for more details about connection reuse.
315         </p>
316       </note>
317
318     </section> <!-- /workers -->
319
320     <section id="access"><title>Controlling Access to Your Proxy</title>
321       <p>You can control who can access your proxy via the <directive
322       module="mod_proxy" type="section">Proxy</directive> control block as in
323       the following example:</p>
324
325       <highlight language="config">
326 &lt;Proxy *&gt;
327   Require ip 192.168.0
328 &lt;/Proxy&gt;
329       </highlight>
330
331       <p>For more information on access control directives, see
332       <module>mod_authz_host</module>.</p>
333
334       <p>Strictly limiting access is essential if you are using a
335       forward proxy (using the <directive
336       module="mod_proxy">ProxyRequests</directive> directive).
337       Otherwise, your server can be used by any client to access
338       arbitrary hosts while hiding his or her true identity.  This is
339       dangerous both for your network and for the Internet at large.
340       When using a reverse proxy (using the <directive
341       module="mod_proxy">ProxyPass</directive> directive with
342       <code>ProxyRequests Off</code>), access control is less
343       critical because clients can only contact the hosts that you
344       have specifically configured.</p>
345
346       <p><strong>See Also</strong> the <a href="mod_proxy_http.html#env"
347       >Proxy-Chain-Auth</a> environment variable.</p>
348
349     </section> <!-- /access -->
350
351     <section id="startup"><title>Slow Startup</title>
352       <p>If you're using the <directive module="mod_proxy"
353       >ProxyBlock</directive> directive, hostnames' IP addresses are looked up
354       and cached during startup for later match test. This may take a few
355       seconds (or more) depending on the speed with which the hostname lookups
356       occur.</p>
357     </section> <!-- /startup -->
358
359     <section id="intranet"><title>Intranet Proxy</title>
360       <p>An Apache httpd proxy server situated in an intranet needs to forward
361       external requests through the company's firewall (for this, configure
362       the <directive module="mod_proxy">ProxyRemote</directive> directive
363       to forward the respective <var>scheme</var> to the firewall proxy).
364       However, when it has to
365       access resources within the intranet, it can bypass the firewall when
366       accessing hosts. The <directive module="mod_proxy">NoProxy</directive>
367       directive is useful for specifying which hosts belong to the intranet and
368       should be accessed directly.</p>
369
370       <p>Users within an intranet tend to omit the local domain name from their
371       WWW requests, thus requesting "http://somehost/" instead of
372       <code>http://somehost.example.com/</code>. Some commercial proxy servers
373       let them get away with this and simply serve the request, implying a
374       configured local domain. When the <directive module="mod_proxy"
375       >ProxyDomain</directive> directive is used and the server is <a
376       href="#proxyrequests">configured for proxy service</a>, Apache httpd can return
377       a redirect response and send the client to the correct, fully qualified,
378       server address. This is the preferred method since the user's bookmark
379       files will then contain fully qualified hosts.</p>
380     </section> <!-- /intranet -->
381
382     <section id="envsettings"><title>Protocol Adjustments</title>
383       <p>For circumstances where <module>mod_proxy</module> is sending
384       requests to an origin server that doesn't properly implement
385       keepalives or HTTP/1.1, there are two <a
386       href="../env.html">environment variables</a> that can force the
387       request to use HTTP/1.0 with no keepalive. These are set via the
388       <directive module="mod_env">SetEnv</directive> directive.</p>
389
390       <p>These are the <code>force-proxy-request-1.0</code> and
391       <code>proxy-nokeepalive</code> notes.</p>
392
393       <highlight language="config">
394 &lt;Location "/buggyappserver/"&gt;
395   ProxyPass "http://buggyappserver:7001/foo/"
396   SetEnv force-proxy-request-1.0 1
397   SetEnv proxy-nokeepalive 1
398 &lt;/Location&gt;
399         </highlight>
400
401     </section> <!-- /envsettings -->
402
403     <section id="request-bodies"><title>Request Bodies</title>
404
405     <p>Some request methods such as POST include a request body.
406     The HTTP protocol requires that requests which include a body
407     either use chunked transfer encoding or send a
408     <code>Content-Length</code> request header.  When passing these
409     requests on to the origin server, <module>mod_proxy_http</module>
410     will always attempt to send the <code>Content-Length</code>.  But
411     if the body is large and the original request used chunked
412     encoding, then chunked encoding may also be used in the upstream
413     request.  You can control this selection using <a
414     href="../env.html">environment variables</a>.  Setting
415     <code>proxy-sendcl</code> ensures maximum compatibility with
416     upstream servers by always sending the
417     <code>Content-Length</code>, while setting
418     <code>proxy-sendchunked</code> minimizes resource usage by using
419     chunked encoding.</p>
420
421     <p>Under some circumstances, the server must spool request bodies
422     to disk to satisfy the requested handling of request bodies.  For
423     example, this spooling will occur if the original body was sent with
424     chunked encoding (and is large), but the administrator has
425     asked for backend requests to be sent with Content-Length or as HTTP/1.0.
426     This spooling can also occur if the request body already has a
427     Content-Length header, but the server is configured to filter incoming
428     request bodies.</p>
429
430     <p><directive module="core">LimitRequestBody</directive> only applies to
431     request bodies that the server will spool to disk</p>
432
433     </section> <!-- /request-bodies -->
434
435     <section id="x-headers"><title>Reverse Proxy Request Headers</title>
436
437     <p>When acting in a reverse-proxy mode (using the <directive
438     module="mod_proxy">ProxyPass</directive> directive, for example),
439     <module>mod_proxy_http</module> adds several request headers in
440     order to pass information to the origin server. These headers
441     are:</p>
442
443     <dl>
444       <dt><code>X-Forwarded-For</code></dt>
445       <dd>The IP address of the client.</dd>
446       <dt><code>X-Forwarded-Host</code></dt>
447       <dd>The original host requested by the client in the <code>Host</code>
448        HTTP request header.</dd>
449       <dt><code>X-Forwarded-Server</code></dt>
450       <dd>The hostname of the proxy server.</dd>
451     </dl>
452
453     <p>Be careful when using these headers on the origin server, since
454     they will contain more than one (comma-separated) value if the
455     original request already contained one of these headers. For
456     example, you can use <code>%{X-Forwarded-For}i</code> in the log
457     format string of the origin server to log the original clients IP
458     address, but you may get more than one address if the request
459     passes through several proxies.</p>
460
461     <p>See also the <directive
462     module="mod_proxy">ProxyPreserveHost</directive> and <directive
463     module="mod_proxy">ProxyVia</directive> directives, which control
464     other request headers.</p>
465
466     <p>Note:  If you need to specify custom request headers to be
467     added to the forwarded request, use the
468     <directive module="mod_headers">RequestHeader</directive>
469     directive.</p>
470
471    </section> <!--/x-headers -->
472
473
474 <directivesynopsis type="section">
475 <name>Proxy</name>
476 <description>Container for directives applied to proxied resources</description>
477 <syntax>&lt;Proxy <var>wildcard-url</var>&gt; ...&lt;/Proxy&gt;</syntax>
478 <contextlist><context>server config</context><context>virtual host</context>
479 </contextlist>
480
481 <usage>
482     <p>Directives placed in <directive type="section">Proxy</directive>
483     sections apply only to matching proxied content.  Shell-style wildcards are
484     allowed.</p>
485
486     <p>For example, the following will allow only hosts in
487     <code>yournetwork.example.com</code> to access content via your proxy
488     server:</p>
489
490     <highlight language="config">
491 &lt;Proxy *&gt;
492   Require host yournetwork.example.com
493 &lt;/Proxy&gt;
494     </highlight>
495
496     <p>The following example will process all files in the <code>foo</code>
497     directory of <code>example.com</code> through the <code>INCLUDES</code>
498     filter when they are sent through the proxy server:</p>
499
500    <highlight language="config">
501 &lt;Proxy http://example.com/foo/*&gt;
502   SetOutputFilter INCLUDES
503 &lt;/Proxy&gt;
504     </highlight>
505
506     <p>The next example will allow web clients from the specified IP
507     addresses to issue <code>CONNECT</code> requests to access the
508     <code>https://www.example.com/</code> SSL server if
509     <module>mod_proxy_connect</module> is enabled.
510     </p>
511
512    <highlight language="config">
513 &lt;Proxy www.example.com:443&gt;
514   Require ip 192.168.0.0/16
515 &lt;/Proxy&gt;
516    </highlight>
517
518     <note><title>Differences from the Location configuration section</title>
519       <p>A backend URL matches the configuration section if it begins with the
520       the <var>wildcard-url</var> string, even if the last path segment in the
521       directive only matches a prefix of the backend URL.  For example,
522       &lt;Proxy http://example.com/foo&gt; matches all of
523       http://example.com/foo, http://example.com/foo/bar, and
524       http://example.com/foobar.  The matching of the final URL differs
525       from the behavior of the <directive type="section" module="core"
526       >Location</directive> section, which for purposes of this note
527       treats the final path component as if it ended in a slash.</p>
528       <p>For more control over the matching, see <directive type="section"
529       >ProxyMatch</directive>.</p>
530     </note>
531
532 </usage>
533 <seealso><directive type="section" module="mod_proxy">ProxyMatch</directive></seealso>
534 </directivesynopsis>
535
536 <directivesynopsis>
537 <name>ProxyBadHeader</name>
538 <description>Determines how to handle bad header lines in a
539 response</description>
540 <syntax>ProxyBadHeader IsError|Ignore|StartBody</syntax>
541 <default>ProxyBadHeader IsError</default>
542 <contextlist><context>server config</context><context>virtual host</context>
543 </contextlist>
544
545 <usage>
546     <p>The <directive>ProxyBadHeader</directive> directive determines the
547     behavior of <module>mod_proxy</module> if it receives syntactically invalid
548     response header lines (<em>i.e.</em> containing no colon) from the origin
549     server. The following arguments are possible:</p>
550
551     <dl>
552     <dt><code>IsError</code></dt>
553     <dd>Abort the request and end up with a 502 (Bad Gateway) response. This is
554     the default behavior.</dd>
555
556     <dt><code>Ignore</code></dt>
557     <dd>Treat bad header lines as if they weren't sent.</dd>
558
559     <dt><code>StartBody</code></dt>
560     <dd>When receiving the first bad header line, finish reading the headers and
561     treat the remainder as body. This helps to work around buggy backend servers
562     which forget to insert an empty line between the headers and the body.</dd>
563     </dl>
564 </usage>
565 </directivesynopsis>
566
567 <directivesynopsis type="section">
568 <name>ProxyMatch</name>
569 <description>Container for directives applied to regular-expression-matched
570 proxied resources</description>
571 <syntax>&lt;ProxyMatch <var>regex</var>&gt; ...&lt;/ProxyMatch&gt;</syntax>
572 <contextlist><context>server config</context><context>virtual host</context>
573 </contextlist>
574
575 <usage>
576     <p>The <directive type="section">ProxyMatch</directive> directive is
577     identical to the <directive module="mod_proxy"
578     type="section">Proxy</directive> directive, except that it matches URLs
579     using <glossary ref="regex">regular expressions</glossary>.</p>
580
581     <p>From 2.4.8 onwards, named groups and backreferences are captured and
582     written to the environment with the corresponding name prefixed with
583     "MATCH_" and in upper case. This allows elements of URLs to be referenced
584     from within <a href="../expr.html">expressions</a> and modules like
585     <module>mod_rewrite</module>. In order to prevent confusion, numbered
586     (unnamed) backreferences are ignored. Use named groups instead.</p>
587
588 <highlight language="config">
589 &lt;ProxyMatch ^http://(?&lt;sitename&gt;[^/]+)&gt;
590     require ldap-group cn=%{env:MATCH_SITENAME},ou=combined,o=Example
591 &lt;/ProxyMatch&gt;
592 </highlight>
593 </usage>
594 <seealso><directive type="section" module="mod_proxy">Proxy</directive></seealso>
595 </directivesynopsis>
596
597 <directivesynopsis>
598 <name>ProxyPreserveHost</name>
599 <description>Use incoming Host HTTP request header for proxy
600 request</description>
601 <syntax>ProxyPreserveHost On|Off</syntax>
602 <default>ProxyPreserveHost Off</default>
603 <contextlist><context>server config</context><context>virtual host</context>
604 <context>directory</context>
605 </contextlist>
606 <compatibility>Usable in directory
607 context in 2.3.3 and later.</compatibility>
608
609 <usage>
610     <p>When enabled, this option will pass the Host: line from the incoming
611     request to the proxied host, instead of the hostname specified in the
612     <directive module="mod_proxy">ProxyPass</directive> line.</p>
613
614     <p>This option should normally be turned <code>Off</code>. It is mostly
615     useful in special configurations like proxied mass name-based virtual
616     hosting, where the original Host header needs to be evaluated by the
617     backend server.</p>
618 </usage>
619 </directivesynopsis>
620
621 <directivesynopsis>
622 <name>ProxyRequests</name>
623 <description>Enables forward (standard) proxy requests</description>
624 <syntax>ProxyRequests On|Off</syntax>
625 <default>ProxyRequests Off</default>
626 <contextlist><context>server config</context><context>virtual host</context>
627 </contextlist>
628
629 <usage>
630     <p>This allows or prevents Apache httpd from functioning as a forward proxy
631     server. (Setting ProxyRequests to <code>Off</code> does not disable use of
632     the <directive module="mod_proxy">ProxyPass</directive> directive.)</p>
633
634     <p>In a typical reverse proxy or gateway configuration, this
635     option should be set to
636     <code>Off</code>.</p>
637
638     <p>In order to get the functionality of proxying HTTP or FTP sites, you
639     need also <module>mod_proxy_http</module> or <module>mod_proxy_ftp</module>
640     (or both) present in the server.</p>
641
642     <p>In order to get the functionality of (forward) proxying HTTPS sites, you
643     need <module>mod_proxy_connect</module> enabled in the server.</p>
644
645     <note type="warning"><title>Warning</title>
646       <p>Do not enable proxying with <directive
647       module="mod_proxy">ProxyRequests</directive> until you have <a
648       href="#access">secured your server</a>.  Open proxy servers are dangerous
649       both to your network and to the Internet at large.</p>
650     </note>
651 </usage>
652 <seealso><a href="#forwardreverse">Forward and Reverse Proxies/Gateways</a></seealso>
653 </directivesynopsis>
654
655 <directivesynopsis>
656 <name>ProxyRemote</name>
657 <description>Remote proxy used to handle certain requests</description>
658 <syntax>ProxyRemote <var>match</var> <var>remote-server</var></syntax>
659 <contextlist><context>server config</context><context>virtual host</context>
660 </contextlist>
661
662 <usage>
663     <p>This defines remote proxies to this proxy. <var>match</var> is either the
664     name of a URL-scheme that the remote server supports, or a partial URL
665     for which the remote server should be used, or <code>*</code> to indicate
666     the server should be contacted for all requests. <var>remote-server</var> is
667     a partial URL for the remote server. Syntax:</p>
668
669     <example>
670       <dfn>remote-server</dfn> =
671           <var>scheme</var>://<var>hostname</var>[:<var>port</var>]
672     </example>
673
674     <p><var>scheme</var> is effectively the protocol that should be used to
675     communicate with the remote server; only <code>http</code> and <code>https</code>
676     are supported by this module. When using <code>https</code>, the requests
677     are forwarded through the remote proxy using the HTTP CONNECT method.</p>
678
679     <example><title>Example</title>
680     <highlight language="config">
681 ProxyRemote http://goodguys.example.com/ http://mirrorguys.example.com:8000
682 ProxyRemote * http://cleverproxy.localdomain
683 ProxyRemote ftp http://ftpproxy.mydomain:8080
684     </highlight>
685     </example>
686
687     <p>In the last example, the proxy will forward FTP requests, encapsulated
688     as yet another HTTP proxy request, to another proxy which can handle
689     them.</p>
690
691     <p>This option also supports reverse proxy configuration; a backend
692     webserver can be embedded within a virtualhost URL space even if that
693     server is hidden by another forward proxy.</p>
694 </usage>
695 </directivesynopsis>
696
697 <directivesynopsis>
698 <name>ProxyRemoteMatch</name>
699 <description>Remote proxy used to handle requests matched by regular
700 expressions</description>
701 <syntax>ProxyRemoteMatch <var>regex</var> <var>remote-server</var></syntax>
702 <contextlist><context>server config</context><context>virtual host</context>
703 </contextlist>
704
705 <usage>
706     <p>The <directive>ProxyRemoteMatch</directive> is identical to the
707     <directive module="mod_proxy">ProxyRemote</directive> directive, except that
708     the first argument is a <glossary ref="regex">regular expression</glossary>
709     match against the requested URL.</p>
710 </usage>
711 </directivesynopsis>
712
713 <directivesynopsis>
714 <name>BalancerGrowth</name>
715 <description>Number of additional Balancers that can be added Post-configuration</description>
716     <syntax>BalancerGrowth <var>#</var></syntax>
717     <default>BalancerGrowth 5</default>
718     <contextlist><context>server config</context><context>virtual host</context></contextlist>
719 <compatibility>BalancerGrowth is only available in Apache HTTP Server 2.3.13
720   and later.</compatibility>
721 <usage>
722     <p>This directive allows for growth potential in the number of
723     Balancers available for a virtualhost in addition to the
724     number pre-configured. It only takes effect if there is at
725     least one pre-configured Balancer.</p>
726 </usage>
727 </directivesynopsis>
728
729 <directivesynopsis>
730     <name>BalancerPersist</name>
731     <description>Attempt to persist changes made by the Balancer Manager across restarts.</description>
732     <syntax>BalancerPersist On|Off</syntax>
733     <default>BalancerPersist Off</default>
734     <contextlist><context>server config</context><context>virtual host</context></contextlist>
735     <compatibility>BalancerPersist is only available in Apache HTTP Server 2.4.4 and later.</compatibility>
736     <usage>
737         <p>This directive will cause the shared memory storage associated
738         with the balancers and balancer members to be persisted across
739         restarts. This allows these local changes to not be lost during the
740         normal restart/graceful state transitions.</p>
741     </usage>
742 </directivesynopsis>
743
744 <directivesynopsis>
745     <name>ProxyPassInherit</name>
746     <description>Inherit ProxyPass directives defined from the main server</description>
747     <syntax>ProxyPassInherit On|Off</syntax>
748     <default>ProxyPassInherit On</default>
749     <contextlist><context>server config</context><context>virtual host</context></contextlist>
750     <compatibility>ProxyPassInherit is only available in Apache HTTP Server 2.4.5 and later.
751         </compatibility>
752     <usage>
753         <p>This directive will cause the current server/vhost to "inherit"
754             <directive module="mod_proxy">ProxyPass</directive>
755             directives defined in the main server. This can cause issues and
756             inconsistent behavior if using the Balancer Manager for dynamic changes
757             and so should be disabled if using that feature.</p>
758         <p>The setting in the global server defines the default for all vhosts.</p>
759         <p>Disabling ProxyPassInherit also disables <directive module="mod_proxy">BalancerInherit</directive>.</p>
760     </usage>
761 </directivesynopsis>
762
763 <directivesynopsis>
764     <name>BalancerInherit</name>
765     <description>Inherit proxy Balancers/Workers defined from the main server</description>
766     <syntax>BalancerInherit On|Off</syntax>
767     <default>BalancerInherit On</default>
768     <contextlist><context>server config</context><context>virtual host</context></contextlist>
769     <compatibility>BalancerInherit is only available in Apache HTTP Server 2.4.5 and later.</compatibility>
770     <usage>
771         <p>This directive will cause the current server/vhost to "inherit"
772             Balancers and Workers defined in the main server. This can cause issues and
773             inconsistent behavior if using the Balancer Manager for dynamic changes
774             and so should be disabled if using that feature.</p>
775         <p>The setting in the global server defines the default for all vhosts.</p>
776         <p>Disabling <directive module="mod_proxy">ProxyPassInherit</directive> also disables BalancerInherit.</p>
777     </usage>
778 </directivesynopsis>
779
780 <directivesynopsis>
781     <name>BalancerMember</name>
782     <description>Add a member to a load balancing group</description>
783     <syntax>BalancerMember [<var>balancerurl</var>] <var>url</var> [<var
784         >key=value [key=value ...]]</var></syntax>
785     <contextlist><context>directory</context>
786     </contextlist>
787     <usage>
788         <p>This directive adds a member to a load balancing group. It can be used
789             within a <code>&lt;Proxy <var>balancer://</var>...&gt;</code> container
790             directive and can take any of the key value pair parameters available to
791             <directive module="mod_proxy">ProxyPass</directive> directives.</p>
792         <p>One additional parameter is available only to <directive>BalancerMember</directive> directives:
793             <var>loadfactor</var>. This is the member load factor - a number between 1
794             (default) and 100, which defines the weighted load to be applied to the
795             member in question.</p>
796         <p>The <var>balancerurl</var> is only needed when not within a
797             <code>&lt;Proxy <var>balancer://</var>...&gt;</code>
798             container directive. It corresponds to the url of a balancer defined in
799             <directive module="mod_proxy">ProxyPass</directive> directive.</p>
800         <p>The path component of the balancer URL in any
801             <code>&lt;Proxy <var>balancer://</var>...&gt;</code> container directive
802             is ignored.</p>
803         <p>Trailing slashes should typically be removed from the URL of a
804             <directive>BalancerMember</directive>.</p>
805     </usage>
806 </directivesynopsis>
807
808 <directivesynopsis>
809 <name>ProxySet</name>
810 <description>Set various Proxy balancer or member parameters</description>
811 <syntax>ProxySet <var>url</var> <var>key=value [key=value ...]</var></syntax>
812 <contextlist><context>directory</context>
813 </contextlist>
814 <usage>
815     <p>This directive is used as an alternate method of setting any of the
816     parameters available to Proxy balancers and workers normally done via the
817     <directive module="mod_proxy">ProxyPass</directive> directive. If used
818     within a <code>&lt;Proxy <var>balancer url|worker url</var>&gt;</code>
819     container directive, the <var>url</var> argument is not required. As a side
820     effect the respective balancer or worker gets created. This can be useful
821     when doing reverse proxying via a
822     <directive module="mod_rewrite">RewriteRule</directive> instead of a
823     <directive module="mod_proxy">ProxyPass</directive> directive.</p>
824
825     <example>
826         <highlight language="config">
827 &lt;Proxy balancer://hotcluster&gt;
828     BalancerMember http://www2.example.com:8080 loadfactor=1
829     BalancerMember http://www3.example.com:8080 loadfactor=2
830     ProxySet lbmethod=bytraffic
831 &lt;/Proxy&gt;
832       </highlight>
833     </example>
834
835     <highlight language="config">
836 &lt;Proxy http://backend&gt;
837     ProxySet keepalive=On
838 &lt;/Proxy&gt;
839     </highlight>
840
841     <highlight language="config">
842         ProxySet balancer://foo lbmethod=bytraffic timeout=15
843     </highlight>
844
845     <highlight language="config">
846         ProxySet ajp://backend:7001 timeout=15
847     </highlight>
848
849    <note type="warning"><title>Warning</title>
850       <p>Keep in mind that the same parameter key can have a different meaning
851       depending whether it is applied to a balancer or a worker, as shown by
852       the two examples above regarding timeout.</p>
853    </note>
854
855 </usage>
856 </directivesynopsis>
857
858 <directivesynopsis>
859 <name>ProxyPass</name>
860 <description>Maps remote servers into the local server URL-space</description>
861 <syntax>ProxyPass [<var>path</var>] !|<var>url</var> [<var>key=value</var>
862   <var>[key=value</var> ...]] [nocanon] [interpolate] [noquery]</syntax>
863 <contextlist><context>server config</context><context>virtual host</context>
864 <context>directory</context>
865 </contextlist>
866 <compatibility>Unix Domain Socket (UDS) support added in 2.4.7</compatibility>
867
868 <usage>
869     <p>This directive allows remote servers to be mapped into the
870     space of the local server. The local server does not act as a
871     proxy in the conventional sense but appears to be a mirror of the
872     remote server. The local server is often called a <dfn>reverse
873     proxy</dfn> or <dfn>gateway</dfn>. The <var>path</var> is the name of
874     a local virtual path; <var>url</var> is a partial URL for the
875     remote server and cannot include a query string.</p>
876
877     <note><strong>Note: </strong>This directive is not supported within
878     <directive type="section" module="core">Directory</directive> and
879     <directive type="section" module="core">Files</directive> containers.</note>
880
881     <note type="warning">The <directive
882     module="mod_proxy">ProxyRequests</directive> directive should
883     usually be set <strong>off</strong> when using
884     <directive>ProxyPass</directive>.</note>
885
886     <p>In 2.4.7 and later, support for using a Unix Domain Socket is available by using a target
887     which prepends <code>unix:/path/lis.sock|</code>. For example, to proxy
888     HTTP and target the UDS at /home/www/socket, you would use
889     <code>unix:/home/www.socket|http://localhost/whatever/</code>. Since
890     the socket is local, the hostname used (in this case <code>localhost</code>)
891     is moot, but it is passed as the Host: header value of the request.</p>
892
893     <note><strong>Note:</strong> The path associated with the <code>unix:</code>
894     URL is <directive>DefaultRuntimeDir</directive> aware.</note>
895
896     <note><strong>Note:</strong> <directive>RewriteRule</directive> requires
897     the <code>[P,NE]</code> option to prevent the <code>'|'</code> character
898     from being escaped.</note>
899
900     <p>When used inside a <directive type="section" module="core"
901     >Location</directive> section, the first argument is omitted and the local
902     directory is obtained from the <directive type="section" module="core"
903     >Location</directive>. The same will occur inside a
904     <directive type="section" module="core">LocationMatch</directive> section;
905     however, ProxyPass does not interpret the regexp as such, so it is necessary
906     to use <directive>ProxyPassMatch</directive> in this situation instead.</p>
907
908     <p>Suppose the local server has address <code>http://example.com/</code>;
909     then</p>
910
911     <highlight language="config">
912 &lt;Location "/mirror/foo/"&gt;
913     ProxyPass "http://backend.example.com/"
914 &lt;/Location&gt;
915     </highlight>
916
917     <p>will cause a local request for
918     <code>http://example.com/mirror/foo/bar</code> to be internally converted
919     into a proxy request to <code>http://backend.example.com/bar</code>.</p>
920
921     <p>If you require a more flexible reverse-proxy configuration, see the
922     <directive module="mod_rewrite">RewriteRule</directive> directive with the
923     <code>[P]</code> flag.</p>
924
925     <p>The following alternative syntax is possible; however, it can carry a
926     performance penalty when present in very large numbers. The advantage of
927     the below syntax is that it allows for dynamic control via the
928     <a href="mod_proxy_balancer.html#balancer_manager">Balancer Manager</a> interface:</p>
929
930     <highlight language="config">
931         ProxyPass "/mirror/foo/" "http://backend.example.com/"
932     </highlight>
933
934     <note type="warning">
935     <p>If the first argument ends with a trailing <strong>/</strong>, the second
936        argument should also end with a trailing <strong>/</strong>, and vice
937        versa. Otherwise, the resulting requests to the backend may miss some
938        needed slashes and do not deliver the expected results.
939     </p>
940     </note>
941
942     <p>The <code>!</code> directive is useful in situations where you don't want
943     to reverse-proxy a subdirectory, <em>e.g.</em></p>
944
945     <highlight language="config">
946 &lt;Location "/mirror/foo/"&gt;
947     ProxyPass "http://backend.example.com/"
948 &lt;/Location&gt;
949 &lt;Location "/mirror/foo/i"&gt;
950     ProxyPass "!"
951 &lt;/Location&gt;
952     </highlight>
953
954     <highlight language="config">
955 ProxyPass "/mirror/foo/i" "!"
956 ProxyPass "/mirror/foo"   "http://backend.example.com"
957     </highlight>
958
959     <p>will proxy all requests to <code>/mirror/foo</code> to
960     <code>backend.example.com</code> <em>except</em> requests made to
961     <code>/mirror/foo/i</code>.</p>
962
963     <note type="warning"><title>Ordering ProxyPass Directives</title>
964       <p>The configured <directive module="mod_proxy">ProxyPass</directive>
965       and <directive module="mod_proxy">ProxyPassMatch</directive>
966       rules are checked in the order of configuration. The first rule that
967       matches wins. So usually you should sort conflicting
968       <directive module="mod_proxy">ProxyPass</directive> rules starting with the
969       longest URLs first. Otherwise, later rules for longer URLS will be hidden
970       by any earlier rule which uses a leading substring of the URL. Note that
971       there is some relation with worker sharing. In contrast, only one
972       <directive module="mod_proxy">ProxyPass</directive> directive can be placed
973       in a <directive module="core">Location</directive> block, and the most
974       specific location will take precedence.</p>
975
976       <p>For the same reasons, exclusions must come <em>before</em> the
977       general <directive>ProxyPass</directive> directives.</p>
978
979     </note> <!-- /ordering_proxypass -->
980
981     <p><strong>ProxyPass <code>key=value</code> Parameters</strong></p>
982
983     <p>In Apache HTTP Server 2.1 and later, mod_proxy supports pooled
984     connections to a backend server.  Connections created on demand
985     can be retained in a pool for future use.  Limits on the pool size
986     and other settings can be coded on
987     the <directive>ProxyPass</directive> directive
988     using  <code>key=value</code> parameters, described in the tables
989     below.</p>
990
991     <p>By default, mod_proxy will allow and retain the maximum number of
992     connections that could be used simultaneously by that web server child
993     process.  Use the <code>max</code> parameter to reduce the number from
994     the default.  Use the <code>ttl</code> parameter to set an optional
995     time to live; connections which have been unused for at least
996     <code>ttl</code> seconds will be closed.  <code>ttl</code> can be used
997     to avoid using a connection which is subject to closing because of the
998     backend server's keep-alive timeout.</p>
999
1000     <p>The pool of connections is maintained per web server child
1001     process, and <code>max</code> and other settings are not coordinated
1002     among all child processes, except when only one child process is allowed
1003     by configuration or MPM design.</p>
1004
1005     <example><title>Example</title>
1006         <highlight language="config">
1007 ProxyPass "/example" "http://backend.example.com" max=20 ttl=120 retry=300
1008         </highlight>
1009     </example>
1010
1011     <table border="2"><tr><th>BalancerMember parameters</th></tr></table>
1012     <table>
1013     <tr><th>Parameter</th>
1014         <th>Default</th>
1015         <th>Description</th></tr>
1016     <tr><td>min</td>
1017         <td>0</td>
1018         <td>Minimum number of connection pool entries, unrelated to the
1019     actual number of connections.  This only needs to be modified from the
1020     default for special circumstances where heap memory associated with the
1021     backend connections should be preallocated or retained.</td></tr>
1022     <tr><td>max</td>
1023         <td>1...n</td>
1024         <td>Maximum number of connections that will be allowed to the
1025     backend server. The default for this limit is the number of threads
1026     per process in the active MPM. In the Prefork MPM, this is always 1;
1027     while with other MPMs, it is controlled by the
1028     <directive>ThreadsPerChild</directive> directive.</td></tr>
1029     <tr><td>smax</td>
1030         <td>max</td>
1031         <td>Retained connection pool entries above this limit are freed
1032     during certain operations if they have been unused for longer than
1033     the time to live, controlled by the <code>ttl</code> parameter.  If
1034     the connection pool entry has an associated connection, it will be
1035     closed.  This only needs to be modified from the default for special
1036     circumstances where connection pool entries and any associated
1037     connections which have exceeded the time to live need to be freed or
1038     closed more aggressively.</td></tr>
1039     <tr><td>acquire</td>
1040         <td>-</td>
1041         <td>If set, this will be the maximum time to wait for a free
1042     connection in the connection pool, in milliseconds. If there are no free
1043     connections in the pool, the Apache httpd will return <code>SERVER_BUSY</code>
1044     status to the client.
1045     </td></tr>
1046     <tr><td>connectiontimeout</td>
1047         <td>timeout</td>
1048         <td>Connect timeout in seconds.
1049         The number of seconds Apache httpd waits for the creation of a connection to
1050         the backend to complete. By adding a postfix of ms, the timeout can be
1051         also set in milliseconds.
1052     </td></tr>
1053     <tr><td>disablereuse</td>
1054         <td>Off</td>
1055         <td>This parameter should be used when you want to force mod_proxy
1056     to immediately close a connection to the backend after being used, and
1057     thus, disable its persistent connection and pool for that backend.
1058     This helps in various situations where a firewall between Apache
1059     httpd and
1060     the backend server (regardless of protocol) tends to silently
1061     drop connections or when backends themselves may be under round-
1062     robin DNS. To disable connection pooling reuse,
1063     set this property value to <code>On</code>.
1064     </td></tr>
1065     <tr><td>enablereuse</td>
1066         <td>On</td>
1067         <td>This is the inverse of 'disablereuse' above, provided as a
1068         convenience for scheme handlers that require opt-in for connection
1069         reuse (such as <module>mod_proxy_fcgi</module>).
1070     </td></tr>
1071     <tr><td>flushpackets</td>
1072         <td>off</td>
1073         <td>Determines whether the proxy module will auto-flush the output
1074         brigade after each "chunk" of data. 'off' means that it will flush
1075         only when needed; 'on' means after each chunk is sent; and
1076         'auto' means poll/wait for a period of time and flush if
1077         no input has been received for 'flushwait' milliseconds.
1078         Currently, this is in effect only for AJP.
1079     </td></tr>
1080     <tr><td>flushwait</td>
1081         <td>10</td>
1082         <td>The time to wait for additional input, in milliseconds, before
1083         flushing the output brigade if 'flushpackets' is 'auto'.
1084     </td></tr>
1085     <tr><td>iobuffersize</td>
1086         <td>8192</td>
1087         <td>Adjusts the size of the internal scratchpad IO buffer. This allows you
1088         to override the <directive>ProxyIOBufferSize</directive> for a specific worker.
1089         This must be at least 512 or set to 0 for the system default of 8192.
1090     </td></tr>
1091     <tr><td>keepalive</td>
1092         <td>Off</td>
1093         <td><p>This parameter should be used when you have a firewall between your
1094     Apache httpd and the backend server, which tends to drop inactive connections.
1095     This flag will tell the Operating System to send <code>KEEP_ALIVE</code>
1096     messages on inactive connections and thus prevent the firewall
1097     from dropping the connection.
1098     To enable keepalive, set this property value to <code>On</code>. </p>
1099     <p>The frequency of initial and subsequent TCP keepalive probes
1100     depends on global OS settings, and may be as high as 2 hours. To be useful,
1101     the frequency configured in the OS must be smaller than the threshold used
1102     by the firewall.</p>
1103     </td></tr>
1104     <tr><td>lbset</td>
1105         <td>0</td>
1106         <td>Sets the load balancer cluster set that the worker is a member
1107          of. The load balancer will try all members of a lower numbered
1108          lbset before trying higher numbered ones.
1109     </td></tr>
1110     <tr><td>ping</td>
1111         <td>0</td>
1112         <td>Ping property tells the webserver to "test" the connection to
1113         the backend before forwarding the request. For negative values,
1114         the test is a simple socket check; for positive values, it's
1115         a more functional check, dependent upon the protocol. For AJP, it causes
1116         <module>mod_proxy_ajp</module> to send a <code>CPING</code>
1117         request on the ajp13 connection (implemented on Tomcat 3.3.2+, 4.1.28+
1118         and 5.0.13+). For HTTP, it causes <module>mod_proxy_http</module>
1119         to send a <code>100-Continue</code> to the backend (only valid for
1120         HTTP/1.1 - for non HTTP/1.1 backends, this property has no
1121         effect). In both cases, the parameter is the delay in seconds to wait
1122         for the reply.
1123         This feature has been added to avoid problems with hung and
1124         busy backends.
1125         This will increase the network traffic during the normal operation
1126         which could be an issue, but it will lower the
1127         traffic in case some of the cluster nodes are down or busy.
1128         By adding a postfix of ms, the delay can be also set in
1129         milliseconds.
1130     </td></tr>
1131     <tr><td>receivebuffersize</td>
1132         <td>0</td>
1133         <td>Adjusts the size of the explicit (TCP/IP) network buffer size for
1134         proxied connections. This allows you to override the
1135         <directive>ProxyReceiveBufferSize</directive> for a specific worker.
1136         This must be at least 512 or set to 0 for the system default.
1137     </td></tr>
1138     <tr><td>redirect</td>
1139         <td>-</td>
1140         <td>Redirection Route of the worker. This value is usually
1141         set dynamically to enable safe removal of the node from
1142         the cluster. If set, all requests without session id will be
1143         redirected to the BalancerMember that has route parameter
1144         equal to this value.
1145     </td></tr>
1146     <tr><td>retry</td>
1147         <td>60</td>
1148         <td>Connection pool worker retry timeout in seconds.
1149     If the connection pool worker to the backend server is in the error state,
1150     Apache httpd will not forward any requests to that server until the timeout
1151     expires. This enables to shut down the backend server for maintenance
1152     and bring it back online later. A value of 0 means always retry workers
1153     in an error state with no timeout.
1154     </td></tr>
1155     <tr><td>route</td>
1156         <td>-</td>
1157         <td>Route of the worker when used inside load balancer.
1158         The route is a value appended to session id.
1159     </td></tr>
1160     <tr><td>status</td>
1161         <td>-</td>
1162         <td>Single letter value defining the initial status of
1163         this worker.
1164         <table border="1">
1165          <tr><td><code>D</code></td><td>Worker is disabled and will not accept any requests; will be
1166                     automatically retried.</td></tr>
1167          <tr><td><code>S</code></td><td>Worker is administratively stopped; will not accept requests
1168                     and will not be automatically retried</td></tr>
1169          <tr><td><code>I</code></td><td>Worker is in ignore-errors mode and will always be considered available.</td></tr>
1170          <tr><td><code>H</code></td><td>Worker is in hot-standby mode and will only be used if no other
1171                     viable workers are available.</td></tr>
1172          <tr><td><code>E</code></td><td>Worker is in an error state.</td></tr>
1173          <tr><td><code>N</code></td><td>Worker is in drain mode and will only accept existing sticky sessions
1174                     destined for itself and ignore all other requests.</td></tr>
1175         </table>
1176         Status can be set (which is the default) by prepending with '+' or
1177         cleared by prepending with '-'.
1178         Thus, a setting of 'S-E' sets this worker to Stopped and
1179         clears the in-error flag.
1180     </td></tr>
1181     <tr><td>timeout</td>
1182         <td><directive module="mod_proxy">ProxyTimeout</directive></td>
1183         <td>Connection timeout in seconds.
1184         The number of seconds Apache httpd waits for data sent by / to the backend.
1185     </td></tr>
1186     <tr><td>ttl</td>
1187         <td>-</td>
1188         <td>Time to live for inactive connections and associated connection
1189         pool entries, in seconds.  Once reaching this limit, a
1190         connection will not be used again; it will be closed at some
1191         later time.
1192     </td></tr>
1193     <tr><td>flusher</td>
1194         <td>flush</td>
1195         <td><p>Name of the provider used by <module>mod_proxy_fdpass</module>.
1196         See the documentation of this module for more details.</p>
1197     </td></tr>
1198
1199     </table>
1200
1201     <p>If the Proxy directive scheme starts with the
1202     <code>balancer://</code> (eg: <code>balancer://cluster</code>,
1203     any path information is ignored), then a virtual worker that does not really
1204     communicate with the backend server will be created. Instead, it is responsible
1205     for the management of several "real" workers. In that case, the special set of
1206     parameters can be added to this virtual worker. See <module>mod_proxy_balancer</module>
1207     for more information about how the balancer works.
1208     </p>
1209     <table border="2"><tr><th>Balancer parameters</th></tr></table>
1210     <table>
1211     <tr><th>Parameter</th>
1212         <th>Default</th>
1213         <th>Description</th></tr>
1214     <tr><td>lbmethod</td>
1215         <td>byrequests</td>
1216         <td>Balancer load-balance method. Select the load-balancing scheduler
1217         method to use. Either <code>byrequests</code>, to perform weighted
1218         request counting; <code>bytraffic</code>, to perform weighted
1219         traffic byte count balancing; or <code>bybusyness</code>, to perform
1220         pending request balancing. The default is <code>byrequests</code>.
1221     </td></tr>
1222     <tr><td>maxattempts</td>
1223         <td>One less than the number of workers, or 1 with a single worker.</td>
1224         <td>Maximum number of failover attempts before giving up.
1225     </td></tr>
1226     <tr><td>nofailover</td>
1227         <td>Off</td>
1228         <td>If set to <code>On</code>, the session will break if the worker is in
1229         error state or disabled. Set this value to <code>On</code> if backend
1230         servers do not support session replication.
1231     </td></tr>
1232     <tr><td>stickysession</td>
1233         <td>-</td>
1234         <td>Balancer sticky session name. The value is usually set to something
1235         like <code>JSESSIONID</code> or <code>PHPSESSIONID</code>,
1236         and it depends on the backend application server that support sessions.
1237         If the backend application server uses different names for cookies
1238         and url encoded id (like servlet containers), use | to separate them.
1239         The first part is for the cookie; the second is for the path.<br />
1240         Available in Apache HTTP Server 2.4.4 and later.
1241     </td></tr>
1242     <tr><td>stickysessionsep</td>
1243         <td>"."</td>
1244         <td>Sets the separation symbol in the session cookie. Some backend application servers
1245         do not use the '.' as the symbol. For example, the Oracle Weblogic server uses
1246         '!'. The correct symbol can be set using this option. The setting of 'Off'
1247         signifies that no symbol is used.
1248     </td></tr>
1249     <tr><td>scolonpathdelim</td>
1250         <td>Off</td>
1251         <td>If set to <code>On</code>, the semi-colon character ';' will be
1252         used as an additional sticky session path delimiter/separator. This
1253         is mainly used to emulate mod_jk's behavior when dealing with paths such
1254         as <code>JSESSIONID=6736bcf34;foo=aabfa</code>
1255     </td></tr>
1256     <tr><td>timeout</td>
1257         <td>0</td>
1258         <td>Balancer timeout in seconds. If set, this will be the maximum time
1259         to wait for a free worker. The default is to not wait.
1260     </td></tr>
1261     <tr><td>failonstatus</td>
1262         <td>-</td>
1263         <td>A single or comma-separated list of HTTP status codes. If set, this will
1264         force the worker into error state when the backend returns any status code
1265         in the list. Worker recovery behaves the same as other worker errors.
1266     </td></tr>
1267     <tr><td>failontimeout</td>
1268         <td>Off</td>
1269         <td>If set, an IO read timeout after a request is sent to the backend will
1270         force the worker into error state. Worker recovery behaves the same as other
1271         worker errors.<br />
1272         Available in Apache HTTP Server 2.4.5 and later.
1273     </td></tr>
1274     <tr><td>nonce</td>
1275         <td>&lt;auto&gt;</td>
1276         <td>The protective nonce used in the <code>balancer-manager</code> application page.
1277         The default is to use an automatically determined UUID-based
1278         nonce, to provide for further protection for the page. If set,
1279         then the nonce is set to that value. A setting of <code>None</code>
1280         disables all nonce checking.
1281     <note><title>Note</title>
1282       <p>In addition to the nonce, the <code>balancer-manager</code> page
1283       should be protected via an ACL.</p>
1284     </note>
1285      </td></tr>
1286     <tr><td>growth</td>
1287         <td>0</td>
1288         <td>Number of additional BalancerMembers to allow to be added
1289         to this balancer in addition to those defined at configuration.
1290     </td></tr>
1291     <tr><td>forcerecovery</td>
1292         <td>On</td>
1293         <td>Force the immediate recovery of all workers without considering the
1294         retry parameter of the workers if all workers of a balancer are
1295         in error state. There might be cases where an already overloaded backend
1296         can get into deeper trouble if the recovery of all workers is enforced
1297         without considering the retry parameter of each worker. In this case,
1298         set to <code>Off</code>.<br />
1299         Available in Apache HTTP Server 2.4.2 and later.
1300     </td></tr>
1301
1302     </table>
1303     <p>A sample balancer setup:</p>
1304     <highlight language="config">
1305 ProxyPass "/special-area" "http://special.example.com" smax=5 max=10
1306 ProxyPass "/"             "balancer://mycluster/" stickysession=JSESSIONID|jsessionid nofailover=On
1307 &lt;Proxy balancer://mycluster&gt;
1308     BalancerMember ajp://1.2.3.4:8009
1309     BalancerMember ajp://1.2.3.5:8009 loadfactor=20
1310     # Less powerful server, don't send as many requests there,
1311     BalancerMember ajp://1.2.3.6:8009 loadfactor=5
1312 &lt;/Proxy&gt;
1313     </highlight>
1314
1315     <p>Setting up a hot-standby that will only be used if no other
1316      members are available:</p>
1317     <highlight language="config">
1318 ProxyPass "/" "balancer://hotcluster/"
1319 &lt;Proxy balancer://hotcluster&gt;
1320     BalancerMember ajp://1.2.3.4:8009 loadfactor=1
1321     BalancerMember ajp://1.2.3.5:8009 loadfactor=2
1322     # The server below is on hot standby
1323     BalancerMember ajp://1.2.3.6:8009 status=+H
1324     ProxySet lbmethod=bytraffic
1325 &lt;/Proxy&gt;
1326     </highlight>
1327
1328     <p><strong>Additional ProxyPass Keywords</strong></p>
1329
1330     <p>Normally, mod_proxy will canonicalise ProxyPassed URLs.
1331     But this may be incompatible with some backends, particularly those
1332     that make use of <var>PATH_INFO</var>.  The optional <var>nocanon</var>
1333     keyword suppresses this and passes the URL path "raw" to the
1334     backend.  Note that this keyword may affect the security of your backend,
1335     as it removes the normal limited protection against URL-based attacks
1336     provided by the proxy.</p>
1337
1338     <p>Normally, mod_proxy will include the query string when
1339     generating the <var>SCRIPT_FILENAME</var> environment variable.
1340     The optional <var>noquery</var> keyword (available in
1341     httpd 2.4.1 and later) prevents this.</p>
1342
1343     <p>The optional <var>interpolate</var> keyword, in combination with
1344     <directive>ProxyPassInterpolateEnv</directive>, causes the ProxyPass
1345     to interpolate environment variables, using the syntax
1346     <var>${VARNAME}</var>.  Note that many of the standard CGI-derived
1347     environment variables will not exist when this interpolation happens,
1348     so you may still have to resort to <module>mod_rewrite</module>
1349     for complex rules.  Also note that interpolation is not supported
1350     within the scheme portion of a URL.  Dynamic determination of the
1351     scheme can be accomplished with <module>mod_rewrite</module> as in the
1352     following example.</p>
1353
1354     <highlight language="config">
1355 RewriteEngine On
1356
1357 RewriteCond %{HTTPS} =off
1358 RewriteRule . - [E=protocol:http]
1359 RewriteCond %{HTTPS} =on
1360 RewriteRule . - [E=protocol:https]
1361
1362 RewriteRule ^/mirror/foo/(.*) %{ENV:protocol}://backend.example.com/$1 [P]
1363 ProxyPassReverse  "/mirror/foo/" "http://backend.example.com/"
1364 ProxyPassReverse  "/mirror/foo/" "https://backend.example.com/"
1365     </highlight>
1366 </usage>
1367 </directivesynopsis>
1368
1369 <directivesynopsis>
1370 <name>ProxyPassMatch</name>
1371 <description>Maps remote servers into the local server URL-space using regular expressions</description>
1372 <syntax>ProxyPassMatch [<var>regex</var>] !|<var>url</var> [<var>key=value</var>
1373         <var>[key=value</var> ...]]</syntax>
1374 <contextlist><context>server config</context><context>virtual host</context>
1375 <context>directory</context>
1376 </contextlist>
1377
1378 <usage>
1379     <p>This directive is equivalent to <directive module="mod_proxy">ProxyPass</directive>
1380        but makes use of regular expressions instead of simple prefix matching. The
1381        supplied regular expression is matched against the <var>url</var>, and if it
1382        matches, the server will substitute any parenthesized matches into the given
1383        string and use it as a new <var>url</var>.</p>
1384
1385     <note><strong>Note: </strong>This directive cannot be used within a
1386     <code>&lt;Directory&gt;</code> context.</note>
1387
1388     <p>Suppose the local server has address <code>http://example.com/</code>;
1389     then</p>
1390
1391     <highlight language="config">
1392 ProxyPassMatch "^/(.*\.gif)$" "http://backend.example.com/$1"
1393     </highlight>
1394
1395     <p>will cause a local request for
1396     <code>http://example.com/foo/bar.gif</code> to be internally converted
1397     into a proxy request to <code>http://backend.example.com/foo/bar.gif</code>.</p>
1398     <note><title>Note</title>
1399       <p>The URL argument must be parsable as a URL <em>before</em> regexp
1400       substitutions (as well as after).  This limits the matches you can use.
1401       For instance, if we had used</p>
1402       <highlight language="config">
1403 ProxyPassMatch "^(/.*\.gif)$" "http://backend.example.com:8000$1"
1404       </highlight>
1405       <p>in our previous example, it would fail with a syntax error
1406       at server startup.  This is a bug (PR 46665 in the ASF bugzilla),
1407       and the workaround is to reformulate the match:</p>
1408       <highlight language="config">
1409 ProxyPassMatch "^/(.*\.gif)$" "http://backend.example.com:8000/$1"
1410       </highlight>
1411     </note>
1412     <p>The <code>!</code> directive is useful in situations where you don't want
1413     to reverse-proxy a subdirectory.</p>
1414
1415     <p>When used inside a <directive type="section" module="core"
1416     >LocationMatch</directive> section, the first argument is omitted and the
1417     regexp is obtained from the <directive type="section" module="core"
1418     >LocationMatch</directive>.</p>
1419
1420     <p>If you require a more flexible reverse-proxy configuration, see the
1421     <directive module="mod_rewrite">RewriteRule</directive> directive with the
1422     <code>[P]</code> flag.</p>
1423
1424     <note>
1425       <title>Default Substitution</title>
1426       <p>When the URL parameter doesn't use any backreferences into the regular
1427       expression, the original URL will be appended to the URL parameter.
1428       </p>
1429     </note>
1430
1431     <note type="warning">
1432       <title>Security Warning</title>
1433       <p>Take care when constructing the target URL of the rule, considering
1434         the security impact from allowing the client influence over the set of
1435         URLs to which your server will act as a proxy.  Ensure that the scheme
1436         and hostname part of the URL is either fixed or does not allow the
1437         client undue influence.</p>
1438     </note>
1439 </usage>
1440 </directivesynopsis>
1441
1442 <directivesynopsis>
1443 <name>ProxyPassReverse</name>
1444 <description>Adjusts the URL in HTTP response headers sent from a reverse
1445 proxied server</description>
1446 <syntax>ProxyPassReverse [<var>path</var>] <var>url</var>
1447 [<var>interpolate</var>]</syntax>
1448 <contextlist><context>server config</context><context>virtual host</context>
1449 <context>directory</context>
1450 </contextlist>
1451
1452 <usage>
1453     <p>This directive lets Apache httpd adjust the URL in the <code>Location</code>,
1454     <code>Content-Location</code> and <code>URI</code> headers on HTTP
1455     redirect responses. This is essential when Apache httpd is used as a
1456     reverse proxy (or gateway) to avoid bypassing the reverse proxy
1457     because of HTTP redirects on the backend servers which stay behind
1458     the reverse proxy.</p>
1459
1460     <p>Only the HTTP response headers specifically mentioned above
1461     will be rewritten. Apache httpd will not rewrite other response
1462     headers, nor will it by default rewrite URL references inside HTML pages.
1463     This means that if the proxied content contains absolute URL
1464     references, they will bypass the proxy. To rewrite HTML content to
1465     match the proxy, you must load and enable <module>mod_proxy_html</module>.
1466     </p>
1467
1468     <p><var>path</var> is the name of a local virtual path; <var>url</var> is a
1469     partial URL for the remote server. These parameters are used the same way as
1470     for the <directive module="mod_proxy">ProxyPass</directive> directive.</p>
1471
1472     <p>For example, suppose the local server has address
1473     <code>http://example.com/</code>; then</p>
1474
1475     <highlight language="config">
1476 ProxyPass         "/mirror/foo/" "http://backend.example.com/"
1477 ProxyPassReverse  "/mirror/foo/" "http://backend.example.com/"
1478 ProxyPassReverseCookieDomain  backend.example.com  public.example.com
1479 ProxyPassReverseCookiePath  "/"  "/mirror/foo/"
1480     </highlight>
1481
1482     <p>will not only cause a local request for the
1483     <code>http://example.com/mirror/foo/bar</code> to be internally converted
1484     into a proxy request to <code>http://backend.example.com/bar</code>
1485     (the functionality which <code>ProxyPass</code> provides here).
1486     It also takes care of redirects which the server <code>backend.example.com</code> sends
1487     when redirecting <code>http://backend.example.com/bar</code> to
1488     <code>http://backend.example.com/quux</code> . Apache httpd adjusts this to
1489     <code>http://example.com/mirror/foo/quux</code> before forwarding the HTTP
1490     redirect response to the client. Note that the hostname used for
1491     constructing the URL is chosen in respect to the setting of the <directive
1492     module="core">UseCanonicalName</directive> directive.</p>
1493
1494     <p>Note that this <directive>ProxyPassReverse</directive> directive can
1495     also be used in conjunction with the proxy feature
1496     (<code>RewriteRule ...  [P]</code>) from <module>mod_rewrite</module>
1497     because it doesn't depend on a corresponding <directive module="mod_proxy"
1498     >ProxyPass</directive> directive.</p>
1499
1500     <p>The optional <var>interpolate</var> keyword, used together with
1501     <directive>ProxyPassInterpolateEnv</directive>, enables interpolation
1502     of environment variables specified using the format <var>${VARNAME}</var>.
1503     Note that interpolation is not supported within the scheme portion of a
1504     URL.</p>
1505
1506     <p>When used inside a <directive type="section" module="core"
1507     >Location</directive> section, the first argument is omitted and the local
1508     directory is obtained from the <directive type="section" module="core"
1509     >Location</directive>. The same occurs inside a <directive type="section"
1510     module="core">LocationMatch</directive> section, but will probably not work as
1511     intended, as ProxyPassReverse will interpret the regexp literally as a
1512     path; if needed in this situation, specify the ProxyPassReverse outside
1513     the section or in a separate <directive type="section" module="core"
1514     >Location</directive> section.</p>
1515
1516     <p>This directive is not supported in <directive type="section" module="core"
1517     >Directory</directive> or <directive type="section" module="core"
1518     >Files</directive> sections.</p>
1519 </usage>
1520 </directivesynopsis>
1521
1522 <directivesynopsis>
1523 <name>ProxyPassReverseCookieDomain</name>
1524 <description>Adjusts the Domain string in Set-Cookie headers from a reverse-
1525 proxied server</description>
1526 <syntax>ProxyPassReverseCookieDomain <var>internal-domain</var>
1527 <var>public-domain</var> [<var>interpolate</var>]</syntax>
1528 <contextlist><context>server config</context><context>virtual host</context>
1529 <context>directory</context>
1530 </contextlist>
1531 <usage>
1532 <p>Usage is basically similar to
1533 <directive module="mod_proxy">ProxyPassReverse</directive>, but instead of
1534 rewriting headers that are a URL, this rewrites the <code>domain</code>
1535 string in <code>Set-Cookie</code> headers.</p>
1536 </usage>
1537 </directivesynopsis>
1538
1539
1540 <directivesynopsis>
1541 <name>ProxyPassReverseCookiePath</name>
1542 <description>Adjusts the Path string in Set-Cookie headers from a reverse-
1543 proxied server</description>
1544 <syntax>ProxyPassReverseCookiePath <var>internal-path</var>
1545 <var>public-path</var> [<var>interpolate</var>]</syntax>
1546 <contextlist><context>server config</context><context>virtual host</context>
1547 <context>directory</context>
1548 </contextlist>
1549 <usage>
1550 <p>
1551 Useful in conjunction with
1552 <directive module="mod_proxy">ProxyPassReverse</directive>
1553 in situations where backend URL paths are mapped to public paths on the
1554 reverse proxy. This directive rewrites the <code>path</code> string in
1555 <code>Set-Cookie</code> headers. If the beginning of the cookie path matches
1556 <var>internal-path</var>, the cookie path will be replaced with
1557 <var>public-path</var>.
1558 </p><p>
1559 In the example given with
1560 <directive module="mod_proxy">ProxyPassReverse</directive>, the directive:
1561 </p>
1562     <highlight language="config">
1563 ProxyPassReverseCookiePath  "/"  "/mirror/foo/"
1564     </highlight>
1565 <p>
1566 will rewrite a cookie with backend path <code>/</code> (or
1567 <code>/example</code> or, in fact, anything) to <code>/mirror/foo/</code>.
1568 </p>
1569 </usage>
1570 </directivesynopsis>
1571
1572 <directivesynopsis>
1573 <name>ProxyBlock</name>
1574 <description>Disallow proxy requests to certain hosts</description>
1575 <syntax>ProxyBlock *|<var>hostname</var>|<var>partial-hostname</var> [<var>hostname</var>|<var>partial-hostname</var>]...</syntax>
1576 <contextlist><context>server config</context><context>virtual host</context>
1577 </contextlist>
1578
1579 <usage>
1580     <p>The <directive>ProxyBlock</directive> directive can be used to
1581     block FTP or HTTP access to certain hosts via the proxy, based on
1582     a full or partial hostname match, or, if applicable, an IP address
1583     comparison.</p>
1584
1585     <p>Each of the arguments to the <directive>ProxyBlock</directive>
1586     directive can be either <code>*</code> or a alphanumeric string.
1587     At startup, the module will attempt to resolve every alphanumeric
1588     string from a DNS name to a set of IP addresses, but any DNS errors
1589     are ignored.</p>
1590
1591     <p>If an asterisk "<code>*</code>" argument is specified,
1592     <module>mod_proxy</module> will deny access to all FTP or HTTP
1593     sites.</p>
1594
1595     <p>Otherwise, for any request for an HTTP or FTP resource via the
1596     proxy, <module>mod_proxy</module> will check the hostname of the
1597     request URI against each specified string.  If a partial string
1598     match is found, access is denied.  If no matches against hostnames
1599     are found, and a remote (forward) proxy is configured using
1600     <directive>ProxyRemote</directive> or
1601     <directive>ProxyRemoteMatch</directive>, access is allowed.  If no
1602     remote (forward) proxy is configured, the IP address of the
1603     hostname from the URI is compared against all resolved IP
1604     addresses determined at startup.  Access is denied if any match is
1605     found.</p>
1606
1607     <p>Note that the DNS lookups may slow down the startup time of the
1608     server.</p>
1609
1610     <example><title>Example</title>
1611     <highlight language="config">
1612       ProxyBlock news.example.com auctions.example.com friends.example.com
1613       </highlight>
1614     </example>
1615
1616     <p>Note that <code>example</code> would also be sufficient to match any
1617     of these sites.</p>
1618
1619     <p>Hosts would also be matched if referenced by IP address.</p>
1620
1621     <p>Note also that</p>
1622
1623     <highlight language="config">
1624       ProxyBlock *
1625     </highlight>
1626
1627     <p>blocks connections to all sites.</p>
1628 </usage>
1629 </directivesynopsis>
1630
1631 <directivesynopsis>
1632 <name>ProxyReceiveBufferSize</name>
1633 <description>Network buffer size for proxied HTTP and FTP
1634 connections</description>
1635 <syntax>ProxyReceiveBufferSize <var>bytes</var></syntax>
1636 <default>ProxyReceiveBufferSize 0</default>
1637 <contextlist><context>server config</context><context>virtual host</context>
1638 </contextlist>
1639
1640 <usage>
1641     <p>The <directive>ProxyReceiveBufferSize</directive> directive specifies an
1642     explicit (TCP/IP) network buffer size for proxied HTTP and FTP connections,
1643     for increased throughput. It has to be greater than <code>512</code> or set
1644     to <code>0</code> to indicate that the system's default buffer size should
1645     be used.</p>
1646
1647     <example><title>Example</title>
1648     <highlight language="config">
1649       ProxyReceiveBufferSize 2048
1650       </highlight>
1651     </example>
1652 </usage>
1653 </directivesynopsis>
1654
1655 <directivesynopsis>
1656 <name>ProxyIOBufferSize</name>
1657 <description>Determine size of internal data throughput buffer</description>
1658 <syntax>ProxyIOBufferSize <var>bytes</var></syntax>
1659 <default>ProxyIOBufferSize 8192</default>
1660 <contextlist><context>server config</context><context>virtual host</context>
1661 </contextlist>
1662
1663 <usage>
1664     <p>The <directive>ProxyIOBufferSize</directive> directive adjusts the size
1665     of the internal buffer which is used as a scratchpad for the data between
1666     input and output. The size must be at least <code>512</code>.</p>
1667
1668     <p>In almost every case, there's no reason to change that value.</p>
1669
1670     <p>If used with AJP, this directive sets the maximum AJP packet size in
1671     bytes. Values larger than 65536 are set to 65536. If you change it from
1672     the default, you must also change the <code>packetSize</code> attribute of
1673     your AJP connector on the Tomcat side! The attribute
1674     <code>packetSize</code> is only available in Tomcat <code>5.5.20+</code>
1675     and <code>6.0.2+</code></p>
1676
1677     <p>Normally it is not necessary to change the maximum packet size.
1678     Problems with the default value have been reported when sending
1679     certificates or certificate chains.</p>
1680
1681 </usage>
1682 </directivesynopsis>
1683
1684 <directivesynopsis>
1685 <name>ProxyMaxForwards</name>
1686 <description>Maximium number of proxies that a request can be forwarded
1687 through</description>
1688 <syntax>ProxyMaxForwards <var>number</var></syntax>
1689 <default>ProxyMaxForwards -1</default>
1690 <contextlist><context>server config</context><context>virtual host</context>
1691 </contextlist>
1692
1693 <usage>
1694     <p>The <directive>ProxyMaxForwards</directive> directive specifies the
1695     maximum number of proxies through which a request may pass if there's no
1696     <code>Max-Forwards</code> header supplied with the request. This may
1697     be set to prevent infinite proxy loops or a DoS attack.</p>
1698
1699     <example><title>Example</title>
1700     <highlight language="config">
1701       ProxyMaxForwards 15
1702       </highlight>
1703     </example>
1704
1705     <p>Note that setting <directive>ProxyMaxForwards</directive> is a
1706     violation of the HTTP/1.1 protocol (RFC2616), which forbids a Proxy
1707     setting <code>Max-Forwards</code> if the Client didn't set it.
1708     Earlier Apache httpd versions would always set it.  A negative
1709     <directive>ProxyMaxForwards</directive> value, including the
1710     default -1, gives you protocol-compliant behavior but may
1711     leave you open to loops.</p>
1712 </usage>
1713 </directivesynopsis>
1714
1715 <directivesynopsis>
1716 <name>NoProxy</name>
1717 <description>Hosts, domains, or networks that will be connected to
1718 directly</description>
1719 <syntax>NoProxy <var>host</var> [<var>host</var>] ...</syntax>
1720 <contextlist><context>server config</context><context>virtual host</context>
1721 </contextlist>
1722
1723 <usage>
1724     <p>This directive is only useful for Apache httpd proxy servers within
1725     intranets.  The <directive>NoProxy</directive> directive specifies a
1726     list of subnets, IP addresses, hosts and/or domains, separated by
1727     spaces. A request to a host which matches one or more of these is
1728     always served directly, without forwarding to the configured
1729     <directive module="mod_proxy">ProxyRemote</directive> proxy server(s).</p>
1730
1731     <example><title>Example</title>
1732     <highlight language="config">
1733 ProxyRemote  *  http://firewall.example.com:81
1734 NoProxy         .example.com 192.168.112.0/21
1735     </highlight>
1736     </example>
1737
1738     <p>The <var>host</var> arguments to the <directive>NoProxy</directive>
1739     directive are one of the following type list:</p>
1740
1741     <dl>
1742     <!-- ===================== Domain ======================= -->
1743     <dt><var><a name="domain" id="domain">Domain</a></var></dt>
1744     <dd>
1745     <p>A <dfn>Domain</dfn> is a partially qualified DNS domain name, preceded
1746     by a period. It represents a list of hosts which logically belong to the
1747     same DNS domain or zone (<em>i.e.</em>, the suffixes of the hostnames are
1748     all ending in <var>Domain</var>).</p>
1749
1750     <example><title>Examples</title>
1751       .com .example.org.
1752     </example>
1753
1754     <p>To distinguish <var>Domain</var>s from <var><a href="#hostname"
1755     >Hostname</a></var>s (both syntactically and semantically; a DNS domain can
1756     have a DNS A record, too!), <var>Domain</var>s are always written with a
1757     leading period.</p>
1758
1759     <note><title>Note</title>
1760       <p>Domain name comparisons are done without regard to the case, and
1761       <var>Domain</var>s are always assumed to be anchored in the root of the
1762       DNS tree; therefore, the two domains <code>.ExAmple.com</code> and
1763       <code>.example.com.</code> (note the trailing period) are considered
1764       equal. Since a domain comparison does not involve a DNS lookup, it is much
1765       more efficient than subnet comparison.</p>
1766     </note></dd>
1767
1768     <!-- ===================== SubNet ======================= -->
1769     <dt><var><a name="subnet" id="subnet">SubNet</a></var></dt>
1770     <dd>
1771     <p>A <dfn>SubNet</dfn> is a partially qualified internet address in
1772     numeric (dotted quad) form, optionally followed by a slash and the netmask,
1773     specified as the number of significant bits in the <var>SubNet</var>. It is
1774     used to represent a subnet of hosts which can be reached over a common
1775     network interface. In the absence of the explicit net mask it is assumed
1776     that omitted (or zero valued) trailing digits specify the mask. (In this
1777     case, the netmask can only be multiples of 8 bits wide.) Examples:</p>
1778
1779     <dl>
1780     <dt><code>192.168</code> or <code>192.168.0.0</code></dt>
1781     <dd>the subnet 192.168.0.0 with an implied netmask of 16 valid bits
1782     (sometimes used in the netmask form <code>255.255.0.0</code>)</dd>
1783     <dt><code>192.168.112.0/21</code></dt>
1784     <dd>the subnet <code>192.168.112.0/21</code> with a netmask of 21
1785     valid bits (also used in the form <code>255.255.248.0</code>)</dd>
1786     </dl>
1787
1788     <p>As a degenerate case, a <em>SubNet</em> with 32 valid bits is the
1789     equivalent to an <var><a href="#ipaddr">IPAddr</a></var>, while a <var>SubNet</var> with zero
1790     valid bits (<em>e.g.</em>, 0.0.0.0/0) is the same as the constant
1791     <var>_Default_</var>, matching any IP address.</p></dd>
1792
1793     <!-- ===================== IPAddr ======================= -->
1794     <dt><var><a name="ipaddr" id="ipaddr">IPAddr</a></var></dt>
1795     <dd>
1796     <p>A <dfn>IPAddr</dfn> represents a fully qualified internet address in
1797     numeric (dotted quad) form. Usually, this address represents a host, but
1798     there need not necessarily be a DNS domain name connected with the
1799     address.</p>
1800     <example><title>Example</title>
1801       192.168.123.7
1802     </example>
1803
1804     <note><title>Note</title>
1805       <p>An <var>IPAddr</var> does not need to be resolved by the DNS system, so
1806       it can result in more effective apache performance.</p>
1807     </note></dd>
1808
1809     <!-- ===================== Hostname ======================= -->
1810     <dt><var><a name="hostname" id="hostname">Hostname</a></var></dt>
1811     <dd>
1812     <p>A <dfn>Hostname</dfn> is a fully qualified DNS domain name which can
1813     be resolved to one or more <var><a href="#ipaddr">IPAddrs</a></var> via the
1814     DNS domain name service. It represents a logical host (in contrast to
1815     <var><a href="#domain">Domain</a></var>s, see above) and must be resolvable
1816     to at least one <var><a href="#ipaddr">IPAddr</a></var> (or often to a list
1817     of hosts with different <var><a href="#ipaddr">IPAddr</a></var>s).</p>
1818
1819     <example><title>Examples</title>
1820       prep.ai.example.edu<br />
1821       www.example.org
1822     </example>
1823
1824     <note><title>Note</title>
1825       <p>In many situations, it is more effective to specify an <var><a
1826       href="#ipaddr">IPAddr</a></var> in place of a <var>Hostname</var> since a
1827       DNS lookup can be avoided. Name resolution in Apache httpd can take a remarkable
1828       deal of time when the connection to the name server uses a slow PPP
1829       link.</p>
1830       <p><var>Hostname</var> comparisons are done without regard to the case,
1831       and <var>Hostname</var>s are always assumed to be anchored in the root
1832       of the DNS tree; therefore, the two hosts <code>WWW.ExAmple.com</code>
1833       and <code>www.example.com.</code> (note the trailing period) are
1834       considered equal.</p>
1835      </note></dd>
1836     </dl>
1837 </usage>
1838 <seealso><a href="../dns-caveats.html">DNS Issues</a></seealso>
1839 </directivesynopsis>
1840
1841 <directivesynopsis>
1842 <name>ProxyTimeout</name>
1843 <description>Network timeout for proxied requests</description>
1844 <syntax>ProxyTimeout <var>seconds</var></syntax>
1845 <default>Value of <directive module="core">Timeout</directive></default>
1846 <contextlist><context>server config</context><context>virtual host</context>
1847 </contextlist>
1848
1849 <usage>
1850     <p>This directive allows a user to specifiy a timeout on proxy requests.
1851     This is useful when you have a slow/buggy appserver which hangs, and you
1852     would rather just return a timeout and fail gracefully instead of waiting
1853     however long it takes the server to return.</p>
1854 </usage>
1855 </directivesynopsis>
1856
1857 <directivesynopsis>
1858 <name>ProxyDomain</name>
1859 <description>Default domain name for proxied requests</description>
1860 <syntax>ProxyDomain <var>Domain</var></syntax>
1861 <contextlist><context>server config</context><context>virtual host</context>
1862 </contextlist>
1863
1864 <usage>
1865     <p>This directive is only useful for Apache httpd proxy servers within
1866     intranets. The <directive>ProxyDomain</directive> directive specifies
1867     the default domain which the apache proxy server will belong to. If a
1868     request to a host without a domain name is encountered, a redirection
1869     response to the same host with the configured <var>Domain</var> appended
1870     will be generated.</p>
1871
1872     <example><title>Example</title>
1873     <highlight language="config">
1874 ProxyRemote  "*"  "http://firewall.example.com:81"
1875 NoProxy           ".example.com" "192.168.112.0/21"
1876 ProxyDomain       ".example.com"
1877       </highlight>
1878     </example>
1879 </usage>
1880 </directivesynopsis>
1881
1882 <directivesynopsis>
1883 <name>ProxyVia</name>
1884 <description>Information provided in the <code>Via</code> HTTP response
1885 header for proxied requests</description>
1886 <syntax>ProxyVia On|Off|Full|Block</syntax>
1887 <default>ProxyVia Off</default>
1888 <contextlist><context>server config</context><context>virtual host</context>
1889 </contextlist>
1890
1891 <usage>
1892     <p>This directive controls the use of the <code>Via:</code> HTTP
1893     header by the proxy. Its intended use is to control the flow of
1894     proxy requests along a chain of proxy servers.  See <a
1895     href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> (HTTP/1.1), section
1896     14.45 for an explanation of <code>Via:</code> header lines.</p>
1897
1898     <ul>
1899     <li>If set to <code>Off</code>, which is the default, no special processing
1900     is performed. If a request or reply contains a <code>Via:</code> header,
1901     it is passed through unchanged.</li>
1902
1903     <li>If set to <code>On</code>, each request and reply will get a
1904     <code>Via:</code> header line added for the current host.</li>
1905
1906     <li>If set to <code>Full</code>, each generated <code>Via:</code> header
1907     line will additionally have the Apache httpd server version shown as a
1908     <code>Via:</code> comment field.</li>
1909
1910     <li>If set to <code>Block</code>, every proxy request will have all its
1911     <code>Via:</code> header lines removed. No new <code>Via:</code> header will
1912     be generated.</li>
1913     </ul>
1914 </usage>
1915 </directivesynopsis>
1916
1917 <directivesynopsis>
1918 <name>ProxyErrorOverride</name>
1919 <description>Override error pages for proxied content</description>
1920 <syntax>ProxyErrorOverride On|Off</syntax>
1921 <default>ProxyErrorOverride Off</default>
1922 <contextlist><context>server config</context><context>virtual host</context>
1923 <context>directory</context>
1924 </contextlist>
1925
1926 <usage>
1927     <p>This directive is useful for reverse-proxy setups where you want to
1928     have a common look and feel on the error pages seen by the end user.
1929     This also allows for included files (via
1930     <module>mod_include</module>'s SSI) to get
1931     the error code and act accordingly. (Default behavior would display
1932     the error page of the proxied server. Turning this on shows the SSI
1933     Error message.)</p>
1934
1935     <p>This directive does not affect the processing of informational (1xx),
1936     normal success (2xx), or redirect (3xx) responses.</p>
1937 </usage>
1938 </directivesynopsis>
1939
1940 <directivesynopsis>
1941 <name>ProxyPassInterpolateEnv</name>
1942 <description>Enable Environment Variable interpolation in Reverse Proxy configurations</description>
1943 <syntax>ProxyPassInterpolateEnv On|Off</syntax>
1944 <default>ProxyPassInterpolateEnv Off</default>
1945 <contextlist><context>server config</context>
1946 <context>virtual host</context>
1947 <context>directory</context>
1948 </contextlist>
1949
1950 <usage>
1951     <p>This directive, together with the <var>interpolate</var> argument to
1952     <directive>ProxyPass</directive>, <directive>ProxyPassReverse</directive>,
1953     <directive>ProxyPassReverseCookieDomain</directive>, and
1954     <directive>ProxyPassReverseCookiePath</directive>,
1955     enables reverse proxies to be dynamically
1956     configured using environment variables which may be set by
1957     another module such as <module>mod_rewrite</module>.
1958     It affects the <directive>ProxyPass</directive>,
1959     <directive>ProxyPassReverse</directive>,
1960     <directive>ProxyPassReverseCookieDomain</directive>, and
1961     <directive>ProxyPassReverseCookiePath</directive> directives
1962     and causes them to substitute the value of an environment
1963     variable <code>varname</code> for the string <code>${varname}</code>
1964     in configuration directives if the <var>interpolate</var> option is set.</p>
1965     <p>Keep this turned off (for server performance) unless you need it!</p>
1966 </usage>
1967 </directivesynopsis>
1968
1969 <directivesynopsis>
1970 <name>ProxyStatus</name>
1971 <description>Show Proxy LoadBalancer status in mod_status</description>
1972 <syntax>ProxyStatus Off|On|Full</syntax>
1973 <default>ProxyStatus Off</default>
1974 <contextlist><context>server config</context>
1975 <context>virtual host</context>
1976 </contextlist>
1977
1978 <usage>
1979     <p>This directive determines whether or not proxy
1980     loadbalancer status data is displayed via the <module>mod_status</module>
1981     server-status page.</p>
1982     <note><title>Note</title>
1983       <p><strong>Full</strong> is synonymous with <strong>On</strong></p>
1984     </note>
1985
1986 </usage>
1987 </directivesynopsis>
1988
1989 <directivesynopsis>
1990 <name>ProxyAddHeaders</name>
1991 <description>Add proxy information in X-Forwarded-* headers</description>
1992 <syntax>ProxyAddHeaders Off|On</syntax>
1993 <default>ProxyAddHeaders On</default>
1994 <contextlist><context>server config</context>
1995 <context>virtual host</context>
1996 <context>directory</context>
1997 </contextlist>
1998 <compatibility>Available in version 2.3.10 and later</compatibility>
1999
2000 <usage>
2001     <p>This directive determines whether or not proxy related information should be passed to the
2002     backend server through X-Forwarded-For, X-Forwarded-Host and X-Forwarded-Server HTTP headers.</p>
2003     <note><title>Effectiveness</title>
2004      <p>This option is of use only for HTTP proxying, as handled by <module>mod_proxy_http</module>.</p>
2005     </note>
2006 </usage>
2007 </directivesynopsis>
2008
2009 <directivesynopsis>
2010 <name>ProxySourceAddress</name>
2011 <description>Set local IP address for outgoing proxy connections</description>
2012 <syntax>ProxySourceAddress <var>address</var></syntax>
2013 <contextlist><context>server config</context>
2014 <context>virtual host</context>
2015 </contextlist>
2016 <compatibility>Available in version 2.3.9 and later</compatibility>
2017
2018 <usage>
2019     <p>This directive allows to set a specific local address to bind to when connecting
2020     to a backend server.</p>
2021 </usage>
2022 </directivesynopsis>
2023
2024 </modulesynopsis>