1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8 <title>mod_proxy - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.3</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
20 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.3</a> > <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_proxy</h1>
24 <p><span>Available Languages: </span><a href="../en/mod/mod_proxy.html" title="English"> en </a> |
25 <a href="../ja/mod/mod_proxy.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
27 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>HTTP/1.1 proxy/gateway server</td></tr>
28 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
29 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>proxy_module</td></tr>
30 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_proxy.c</td></tr></table>
33 <div class="warning"><h3>Warning</h3>
34 <p>Do not enable proxying with <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> until you have <a href="#access">secured your server</a>. Open proxy servers are dangerous both to your
35 network and to the Internet at large.</p>
38 <p>This module implements a proxy/gateway for Apache. It implements
39 proxying capability for <code>AJP13</code> (Apache JServe Protocol
40 version 1.3), <code>FTP</code>, <code>CONNECT</code> (for SSL),
41 <code>HTTP/0.9</code>, <code>HTTP/1.0</code>, and <code>HTTP/1.1</code>.
42 The module can be configured to connect to other proxy modules for these
43 and other protocols.</p>
45 <p>Apache's proxy features are divided into several modules in
46 addition to <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>:
47 <code class="module"><a href="../mod/mod_proxy_http.html">mod_proxy_http</a></code>, <code class="module"><a href="../mod/mod_proxy_ftp.html">mod_proxy_ftp</a></code>,
48 <code class="module"><a href="../mod/mod_proxy_ajp.html">mod_proxy_ajp</a></code>, <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code>,
49 and <code class="module"><a href="../mod/mod_proxy_connect.html">mod_proxy_connect</a></code>. Thus, if you want to use
50 one or more of the particular proxy functions, load
51 <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> <em>and</em> the appropriate module(s)
52 into the server (either statically at compile-time or dynamically
53 via the <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>
56 <p>In addition, extended features are provided by other modules.
57 Caching is provided by <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> and related
58 modules. The ability to contact remote servers using the SSL/TLS
59 protocol is provided by the <code>SSLProxy*</code> directives of
60 <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code>. These additional modules will need
61 to be loaded and configured to take advantage of these features.</p>
63 <div id="quickview"><h3 class="directives">Directives</h3>
65 <li><img alt="" src="../images/down.gif" /> <a href="#allowconnect">AllowCONNECT</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#balancermember">BalancerMember</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#noproxy">NoProxy</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#proxy"><Proxy></a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#proxybadheader">ProxyBadHeader</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#proxyblock">ProxyBlock</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#proxydomain">ProxyDomain</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#proxyerroroverride">ProxyErrorOverride</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#proxyiobuffersize">ProxyIOBufferSize</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#proxymatch"><ProxyMatch></a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#proxymaxforwards">ProxyMaxForwards</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#proxypass">ProxyPass</a></li>
77 <li><img alt="" src="../images/down.gif" /> <a href="#proxypassinterpolateenv">ProxyPassInterpolateEnv</a></li>
78 <li><img alt="" src="../images/down.gif" /> <a href="#proxypassmatch">ProxyPassMatch</a></li>
79 <li><img alt="" src="../images/down.gif" /> <a href="#proxypassreverse">ProxyPassReverse</a></li>
80 <li><img alt="" src="../images/down.gif" /> <a href="#proxypassreversecookiedomain">ProxyPassReverseCookieDomain</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#proxypassreversecookiepath">ProxyPassReverseCookiePath</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#proxypreservehost">ProxyPreserveHost</a></li>
83 <li><img alt="" src="../images/down.gif" /> <a href="#proxyreceivebuffersize">ProxyReceiveBufferSize</a></li>
84 <li><img alt="" src="../images/down.gif" /> <a href="#proxyremote">ProxyRemote</a></li>
85 <li><img alt="" src="../images/down.gif" /> <a href="#proxyremotematch">ProxyRemoteMatch</a></li>
86 <li><img alt="" src="../images/down.gif" /> <a href="#proxyrequests">ProxyRequests</a></li>
87 <li><img alt="" src="../images/down.gif" /> <a href="#proxytimeout">ProxyTimeout</a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#proxyvia">ProxyVia</a></li>
92 <li><img alt="" src="../images/down.gif" /> <a href="#forwardreverse">Forward and Reverse Proxies</a></li>
93 <li><img alt="" src="../images/down.gif" /> <a href="#examples">Basic Examples</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#access">Controlling access to your proxy</a></li>
95 <li><img alt="" src="../images/down.gif" /> <a href="#startup">Slow Startup</a></li>
96 <li><img alt="" src="../images/down.gif" /> <a href="#intranet">Intranet Proxy</a></li>
97 <li><img alt="" src="../images/down.gif" /> <a href="#envsettings">Protocol Adjustments</a></li>
98 <li><img alt="" src="../images/down.gif" /> <a href="#request-bodies">Request Bodys</a></li>
99 </ul><h3>See also</h3>
101 <li><code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code></li>
102 <li><code class="module"><a href="../mod/mod_proxy_http.html">mod_proxy_http</a></code></li>
103 <li><code class="module"><a href="../mod/mod_proxy_ftp.html">mod_proxy_ftp</a></code></li>
104 <li><code class="module"><a href="../mod/mod_proxy_connect.html">mod_proxy_connect</a></code></li>
105 <li><code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code></li>
106 <li><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></li>
108 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
109 <div class="section">
110 <h2><a name="forwardreverse" id="forwardreverse">Forward and Reverse Proxies</a></h2>
111 <p>Apache can be configured in both a <dfn>forward</dfn> and
112 <dfn>reverse</dfn> proxy mode.</p>
114 <p>An ordinary <dfn>forward proxy</dfn> is an intermediate
115 server that sits between the client and the <em>origin
116 server</em>. In order to get content from the origin server,
117 the client sends a request to the proxy naming the origin server
118 as the target and the proxy then requests the content from the
119 origin server and returns it to the client. The client must be
120 specially configured to use the forward proxy to access other
123 <p>A typical usage of a forward proxy is to provide Internet
124 access to internal clients that are otherwise restricted by a
125 firewall. The forward proxy can also use caching (as provided
126 by <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code>) to reduce network usage.</p>
128 <p>The forward proxy is activated using the <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> directive. Because
129 forward proxys allow clients to access arbitrary sites through
130 your server and to hide their true origin, it is essential that
131 you <a href="#access">secure your server</a> so that only
132 authorized clients can access the proxy before activating a
135 <p>A <dfn>reverse proxy</dfn>, by contrast, appears to the
136 client just like an ordinary web server. No special
137 configuration on the client is necessary. The client makes
138 ordinary requests for content in the name-space of the reverse
139 proxy. The reverse proxy then decides where to send those
140 requests, and returns the content as if it was itself the
143 <p>A typical usage of a reverse proxy is to provide Internet
144 users access to a server that is behind a firewall. Reverse
145 proxies can also be used to balance load among several back-end
146 servers, or to provide caching for a slower back-end server.
147 In addition, reverse proxies can be used simply to bring
148 several servers into the same URL space.</p>
150 <p>A reverse proxy is activated using the <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive or the
151 <code>[P]</code> flag to the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> directive. It is
152 <strong>not</strong> necessary to turn <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> on in order to
153 configure a reverse proxy.</p>
154 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
155 <div class="section">
156 <h2><a name="examples" id="examples">Basic Examples</a></h2>
158 <p>The examples below are only a very basic idea to help you
159 get started. Please read the documentation on the individual
162 <p>In addition, if you wish to have caching enabled, consult
163 the documentation from <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code>.</p>
165 <div class="example"><h3>Forward Proxy</h3><p><code>
166 ProxyRequests On<br />
169 <Proxy *><br />
170 <span class="indent">
171 Order deny,allow<br />
173 Allow from internal.example.com<br />
178 <div class="example"><h3>Reverse Proxy</h3><p><code>
179 ProxyRequests Off<br />
181 <Proxy *><br />
182 <span class="indent">
183 Order deny,allow<br />
188 ProxyPass /foo http://foo.example.com/bar<br />
189 ProxyPassReverse /foo http://foo.example.com/bar
191 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
192 <div class="section">
193 <h2><a name="access" id="access">Controlling access to your proxy</a></h2>
194 <p>You can control who can access your proxy via the <code class="directive"><a href="#proxy"><Proxy></a></code> control block as in
195 the following example:</p>
197 <div class="example"><p><code>
198 <Proxy *><br />
199 <span class="indent">
200 Order Deny,Allow<br />
202 Allow from 192.168.0<br />
207 <p>For more information on access control directives, see
208 <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code>.</p>
210 <p>Strictly limiting access is essential if you are using a
211 forward proxy (using the <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> directive).
212 Otherwise, your server can be used by any client to access
213 arbitrary hosts while hiding his or her true identity. This is
214 dangerous both for your network and for the Internet at large.
215 When using a reverse proxy (using the <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive with
216 <code>ProxyRequests Off</code>), access control is less
217 critical because clients can only contact the hosts that you
218 have specifically configured.</p>
220 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
221 <div class="section">
222 <h2><a name="startup" id="startup">Slow Startup</a></h2>
223 <p>If you're using the <code class="directive"><a href="#proxyblock">ProxyBlock</a></code> directive, hostnames' IP addresses are looked up
224 and cached during startup for later match test. This may take a few
225 seconds (or more) depending on the speed with which the hostname lookups
227 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
228 <div class="section">
229 <h2><a name="intranet" id="intranet">Intranet Proxy</a></h2>
230 <p>An Apache proxy server situated in an intranet needs to forward
231 external requests through the company's firewall (for this, configure
232 the <code class="directive"><a href="#proxyremote">ProxyRemote</a></code> directive
233 to forward the respective <var>scheme</var> to the firewall proxy).
234 However, when it has to
235 access resources within the intranet, it can bypass the firewall when
236 accessing hosts. The <code class="directive"><a href="#noproxy">NoProxy</a></code>
237 directive is useful for specifying which hosts belong to the intranet and
238 should be accessed directly.</p>
240 <p>Users within an intranet tend to omit the local domain name from their
241 WWW requests, thus requesting "http://somehost/" instead of
242 <code>http://somehost.example.com/</code>. Some commercial proxy servers
243 let them get away with this and simply serve the request, implying a
244 configured local domain. When the <code class="directive"><a href="#proxydomain">ProxyDomain</a></code> directive is used and the server is <a href="#proxyrequests">configured for proxy service</a>, Apache can return
245 a redirect response and send the client to the correct, fully qualified,
246 server address. This is the preferred method since the user's bookmark
247 files will then contain fully qualified hosts.</p>
248 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
249 <div class="section">
250 <h2><a name="envsettings" id="envsettings">Protocol Adjustments</a></h2>
251 <p>For circumstances where <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> is sending
252 requests to an origin server that doesn't properly implement
253 keepalives or HTTP/1.1, there are two <a href="../env.html">environment variables</a> that can force the
254 request to use HTTP/1.0 with no keepalive. These are set via the
255 <code class="directive"><a href="../mod/mod_env.html#setenv">SetEnv</a></code> directive.</p>
257 <p>These are the <code>force-proxy-request-1.0</code> and
258 <code>proxy-nokeepalive</code> notes.</p>
260 <div class="example"><p><code>
261 <Location /buggyappserver/><br />
262 <span class="indent">
263 ProxyPass http://buggyappserver:7001/foo/<br />
264 SetEnv force-proxy-request-1.0 1<br />
265 SetEnv proxy-nokeepalive 1<br />
270 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
271 <div class="section">
272 <h2><a name="request-bodies" id="request-bodies">Request Bodys</a></h2>
274 <p>Some request methods such as POST include a request body.
275 The HTTP protocol requires that requests which include a body
276 either use chunked transfer encoding or send a
277 <code>Content-Length</code> request header. When passing these
278 requests on to the origin server, <code class="module"><a href="../mod/mod_proxy_http.html">mod_proxy_http</a></code>
279 will always attempt to send the <code>Content-Length</code>. But
280 if the body is large and the original request used chunked
281 encoding, then chunked encoding may also be used in the upstream
282 request. You can control this selection using <a href="../env.html">environment variables</a>. Setting
283 <code>proxy-sendcl</code> ensures maximum compatibility with
284 upstream servers by always sending the
285 <code>Content-Length</code>, while setting
286 <code>proxy-sendchunked</code> minimizes resource usage by using
287 chunked encoding.</p>
290 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
291 <div class="directive-section"><h2><a name="AllowCONNECT" id="AllowCONNECT">AllowCONNECT</a> <a name="allowconnect" id="allowconnect">Directive</a></h2>
292 <table class="directive">
293 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Ports that are allowed to <code>CONNECT</code> through the
295 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AllowCONNECT <var>port</var> [<var>port</var>] ...</code></td></tr>
296 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>AllowCONNECT 443 563</code></td></tr>
297 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
298 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
299 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
301 <p>The <code class="directive">AllowCONNECT</code> directive specifies a list
302 of port numbers to which the proxy <code>CONNECT</code> method may
303 connect. Today's browsers use this method when a <code>https</code>
304 connection is requested and proxy tunneling over HTTP is in effect.</p>
306 <p>By default, only the default https port (<code>443</code>) and the
307 default snews port (<code>563</code>) are enabled. Use the
308 <code class="directive">AllowCONNECT</code> directive to override this default and
309 allow connections to the listed ports only.</p>
311 <p>Note that you'll need to have <code class="module"><a href="../mod/mod_proxy_connect.html">mod_proxy_connect</a></code> present
312 in the server in order to get the support for the <code>CONNECT</code> at
316 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
317 <div class="directive-section"><h2><a name="BalancerMember" id="BalancerMember">BalancerMember</a> <a name="balancermember" id="balancermember">Directive</a></h2>
318 <table class="directive">
319 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Add a member to a load balancing group</td></tr>
320 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>BalancerMember <var>url</var> [<var>key=value [key=value ...]]</var></code></td></tr>
321 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
322 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
323 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
324 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>BalancerMember is only available in Apache 2.2.0
327 <p>This directive adds a member to a load balancing group. It must be used
328 within a <code><Proxy <var>balancer://</var>...></code> container
329 directive, and can take any of the parameters available to
330 <code class="directive"><a href="#proxypass">ProxyPass</a></code> directives.</p>
331 <p>One additional parameter is available only to <code class="directive"><a href="#balancermember">BalancerMember</a></code> directives:
332 <var>loadfactor</var>. This is the member load factor - a number between 1
333 (default) and 100, which defines the weighted load to be applied to the
334 member in question.</p>
337 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
338 <div class="directive-section"><h2><a name="NoProxy" id="NoProxy">NoProxy</a> <a name="noproxy" id="noproxy">Directive</a></h2>
339 <table class="directive">
340 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Hosts, domains, or networks that will be connected to
342 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NoProxy <var>host</var> [<var>host</var>] ...</code></td></tr>
343 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
344 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
345 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
347 <p>This directive is only useful for Apache proxy servers within
348 intranets. The <code class="directive">NoProxy</code> directive specifies a
349 list of subnets, IP addresses, hosts and/or domains, separated by
350 spaces. A request to a host which matches one or more of these is
351 always served directly, without forwarding to the configured
352 <code class="directive"><a href="#proxyremote">ProxyRemote</a></code> proxy server(s).</p>
354 <div class="example"><h3>Example</h3><p><code>
355 ProxyRemote * http://firewall.mycompany.com:81<br />
356 NoProxy .mycompany.com 192.168.112.0/21
359 <p>The <var>host</var> arguments to the <code class="directive">NoProxy</code>
360 directive are one of the following type list:</p>
364 <dt><var><a name="domain" id="domain">Domain</a></var></dt>
366 <p>A <dfn>Domain</dfn> is a partially qualified DNS domain name, preceded
367 by a period. It represents a list of hosts which logically belong to the
368 same DNS domain or zone (<em>i.e.</em>, the suffixes of the hostnames are
369 all ending in <var>Domain</var>).</p>
371 <div class="example"><h3>Examples</h3><p><code>
375 <p>To distinguish <var>Domain</var>s from <var><a href="#hostname">Hostname</a></var>s (both syntactically and semantically; a DNS domain can
376 have a DNS A record, too!), <var>Domain</var>s are always written with a
379 <div class="note"><h3>Note</h3>
380 <p>Domain name comparisons are done without regard to the case, and
381 <var>Domain</var>s are always assumed to be anchored in the root of the
382 DNS tree, therefore two domains <code>.MyDomain.com</code> and
383 <code>.mydomain.com.</code> (note the trailing period) are considered
384 equal. Since a domain comparison does not involve a DNS lookup, it is much
385 more efficient than subnet comparison.</p>
389 <dt><var><a name="subnet" id="subnet">SubNet</a></var></dt>
391 <p>A <dfn>SubNet</dfn> is a partially qualified internet address in
392 numeric (dotted quad) form, optionally followed by a slash and the netmask,
393 specified as the number of significant bits in the <var>SubNet</var>. It is
394 used to represent a subnet of hosts which can be reached over a common
395 network interface. In the absence of the explicit net mask it is assumed
396 that omitted (or zero valued) trailing digits specify the mask. (In this
397 case, the netmask can only be multiples of 8 bits wide.) Examples:</p>
400 <dt><code>192.168</code> or <code>192.168.0.0</code></dt>
401 <dd>the subnet 192.168.0.0 with an implied netmask of 16 valid bits
402 (sometimes used in the netmask form <code>255.255.0.0</code>)</dd>
403 <dt><code>192.168.112.0/21</code></dt>
404 <dd>the subnet <code>192.168.112.0/21</code> with a netmask of 21
405 valid bits (also used in the form <code>255.255.248.0</code>)</dd>
408 <p>As a degenerate case, a <em>SubNet</em> with 32 valid bits is the
409 equivalent to an <var><a href="#ipadr">IPAddr</a></var>, while a <var>SubNet</var> with zero
410 valid bits (<em>e.g.</em>, 0.0.0.0/0) is the same as the constant
411 <var>_Default_</var>, matching any IP address.</p></dd>
414 <dt><var><a name="ipaddr" id="ipaddr">IPAddr</a></var></dt>
416 <p>A <dfn>IPAddr</dfn> represents a fully qualified internet address in
417 numeric (dotted quad) form. Usually, this address represents a host, but
418 there need not necessarily be a DNS domain name connected with the
420 <div class="example"><h3>Example</h3><p><code>
424 <div class="note"><h3>Note</h3>
425 <p>An <var>IPAddr</var> does not need to be resolved by the DNS system, so
426 it can result in more effective apache performance.</p>
430 <dt><var><a name="hostname" id="hostname">Hostname</a></var></dt>
432 <p>A <dfn>Hostname</dfn> is a fully qualified DNS domain name which can
433 be resolved to one or more <var><a href="#ipaddr">IPAddrs</a></var> via the
434 DNS domain name service. It represents a logical host (in contrast to
435 <var><a href="#domain">Domain</a></var>s, see above) and must be resolvable
436 to at least one <var><a href="#ipaddr">IPAddr</a></var> (or often to a list
437 of hosts with different <var><a href="#ipaddr">IPAddr</a></var>s).</p>
439 <div class="example"><h3>Examples</h3><p><code>
440 prep.ai.mit.edu<br />
444 <div class="note"><h3>Note</h3>
445 <p>In many situations, it is more effective to specify an <var><a href="#ipaddr">IPAddr</a></var> in place of a <var>Hostname</var> since a
446 DNS lookup can be avoided. Name resolution in Apache can take a remarkable
447 deal of time when the connection to the name server uses a slow PPP
449 <p><var>Hostname</var> comparisons are done without regard to the case,
450 and <var>Hostname</var>s are always assumed to be anchored in the root
451 of the DNS tree, therefore two hosts <code>WWW.MyDomain.com</code>
452 and <code>www.mydomain.com.</code> (note the trailing period) are
453 considered equal.</p>
459 <li><a href="../dns-caveats.html">DNS Issues</a></li>
462 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
463 <div class="directive-section"><h2><a name="Proxy" id="Proxy"><Proxy></a> <a name="proxy" id="proxy">Directive</a></h2>
464 <table class="directive">
465 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Container for directives applied to proxied resources</td></tr>
466 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Proxy <var>wildcard-url</var>> ...</Proxy></code></td></tr>
467 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
468 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
469 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
471 <p>Directives placed in <code class="directive"><Proxy></code>
472 sections apply only to matching proxied content. Shell-style wildcards are
475 <p>For example, the following will allow only hosts in
476 <code>yournetwork.example.com</code> to access content via your proxy
479 <div class="example"><p><code>
480 <Proxy *><br />
481 <span class="indent">
482 Order Deny,Allow<br />
484 Allow from yournetwork.example.com<br />
489 <p>The following example will process all files in the <code>foo</code>
490 directory of <code>example.com</code> through the <code>INCLUDES</code>
491 filter when they are sent through the proxy server:</p>
493 <div class="example"><p><code>
494 <Proxy http://example.com/foo/*><br />
495 <span class="indent">
496 SetOutputFilter INCLUDES<br />
503 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
504 <div class="directive-section"><h2><a name="ProxyBadHeader" id="ProxyBadHeader">ProxyBadHeader</a> <a name="proxybadheader" id="proxybadheader">Directive</a></h2>
505 <table class="directive">
506 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines how to handle bad header lines in a
508 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyBadHeader IsError|Ignore|StartBody</code></td></tr>
509 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyBadHeader IsError</code></td></tr>
510 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
511 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
512 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
513 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>available in Apache 2.0.44 and later</td></tr>
515 <p>The <code class="directive">ProxyBadHeader</code> directive determines the
516 behaviour of <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> if it receives syntactically invalid
517 header lines (<em>i.e.</em> containing no colon). The following arguments
521 <dt><code>IsError</code></dt>
522 <dd>Abort the request and end up with a 502 (Bad Gateway) response. This is
523 the default behaviour.</dd>
525 <dt><code>Ignore</code></dt>
526 <dd>Treat bad header lines as if they weren't sent.</dd>
528 <dt><code>StartBody</code></dt>
529 <dd>When receiving the first bad header line, finish reading the headers and
530 treat the remainder as body. This helps to work around buggy backend servers
531 which forget to insert an empty line between the headers and the body.</dd>
535 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
536 <div class="directive-section"><h2><a name="ProxyBlock" id="ProxyBlock">ProxyBlock</a> <a name="proxyblock" id="proxyblock">Directive</a></h2>
537 <table class="directive">
538 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Words, hosts, or domains that are banned from being
540 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyBlock *|<var>word</var>|<var>host</var>|<var>domain</var>
541 [<var>word</var>|<var>host</var>|<var>domain</var>] ...</code></td></tr>
542 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
543 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
544 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
546 <p>The <code class="directive">ProxyBlock</code> directive specifies a list of
547 words, hosts and/or domains, separated by spaces. HTTP, HTTPS, and
548 FTP document requests to sites whose names contain matched words,
549 hosts or domains are <em>blocked</em> by the proxy server. The proxy
550 module will also attempt to determine IP addresses of list items which
551 may be hostnames during startup, and cache them for match test as
552 well. That may slow down the startup time of the server.</p>
554 <div class="example"><h3>Example</h3><p><code>
555 ProxyBlock joes-garage.com some-host.co.uk rocky.wotsamattau.edu
558 <p><code>rocky.wotsamattau.edu</code> would also be matched if referenced by
561 <p>Note that <code>wotsamattau</code> would also be sufficient to match
562 <code>wotsamattau.edu</code>.</p>
564 <p>Note also that</p>
566 <div class="example"><p><code>
570 <p>blocks connections to all sites.</p>
573 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
574 <div class="directive-section"><h2><a name="ProxyDomain" id="ProxyDomain">ProxyDomain</a> <a name="proxydomain" id="proxydomain">Directive</a></h2>
575 <table class="directive">
576 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default domain name for proxied requests</td></tr>
577 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyDomain <var>Domain</var></code></td></tr>
578 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
579 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
580 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
582 <p>This directive is only useful for Apache proxy servers within
583 intranets. The <code class="directive">ProxyDomain</code> directive specifies
584 the default domain which the apache proxy server will belong to. If a
585 request to a host without a domain name is encountered, a redirection
586 response to the same host with the configured <var>Domain</var> appended
587 will be generated.</p>
589 <div class="example"><h3>Example</h3><p><code>
590 ProxyRemote * http://firewall.mycompany.com:81<br />
591 NoProxy .mycompany.com 192.168.112.0/21<br />
592 ProxyDomain .mycompany.com
596 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
597 <div class="directive-section"><h2><a name="ProxyErrorOverride" id="ProxyErrorOverride">ProxyErrorOverride</a> <a name="proxyerroroverride" id="proxyerroroverride">Directive</a></h2>
598 <table class="directive">
599 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Override error pages for proxied content</td></tr>
600 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyErrorOverride On|Off</code></td></tr>
601 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyErrorOverride Off</code></td></tr>
602 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
603 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
604 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
605 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0 and later</td></tr>
607 <p>This directive is useful for reverse-proxy setups, where you want to
608 have a common look and feel on the error pages seen by the end user.
609 This also allows for included files (via
610 <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>'s SSI) to get
611 the error code and act accordingly (default behavior would display
612 the error page of the proxied server, turning this on shows the SSI
615 <p>This directive does not affect the processing of informational (1xx),
616 normal success (2xx), or redirect (3xx) responses.</p>
619 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
620 <div class="directive-section"><h2><a name="ProxyIOBufferSize" id="ProxyIOBufferSize">ProxyIOBufferSize</a> <a name="proxyiobuffersize" id="proxyiobuffersize">Directive</a></h2>
621 <table class="directive">
622 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine size of internal data throughput buffer</td></tr>
623 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyIOBufferSize <var>bytes</var></code></td></tr>
624 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyIOBufferSize 8192</code></td></tr>
625 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
626 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
627 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
629 <p>The <code class="directive">ProxyIOBufferSize</code> directive adjusts the size
630 of the internal buffer, which is used as a scratchpad for the data between
631 input and output. The size must be less or equal <code>8192</code>.</p>
633 <p>In almost every case there's no reason to change that value.</p>
636 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
637 <div class="directive-section"><h2><a name="ProxyMatch" id="ProxyMatch"><ProxyMatch></a> <a name="proxymatch" id="proxymatch">Directive</a></h2>
638 <table class="directive">
639 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Container for directives applied to regular-expression-matched
640 proxied resources</td></tr>
641 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><ProxyMatch <var>regex</var>> ...</ProxyMatch></code></td></tr>
642 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
643 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
644 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
646 <p>The <code class="directive"><ProxyMatch></code> directive is
647 identical to the <code class="directive"><a href="#proxy"><Proxy></a></code> directive, except it matches URLs
648 using <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expressions</a>.</p>
651 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
652 <div class="directive-section"><h2><a name="ProxyMaxForwards" id="ProxyMaxForwards">ProxyMaxForwards</a> <a name="proxymaxforwards" id="proxymaxforwards">Directive</a></h2>
653 <table class="directive">
654 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximium number of proxies that a request can be forwarded
656 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyMaxForwards <var>number</var></code></td></tr>
657 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyMaxForwards 10</code></td></tr>
658 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
659 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
660 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
661 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0 and later</td></tr>
663 <p>The <code class="directive">ProxyMaxForwards</code> directive specifies the
664 maximum number of proxies through which a request may pass, if there's no
665 <code>Max-Forwards</code> header supplied with the request. This is
666 set to prevent infinite proxy loops, or a DoS attack.</p>
668 <div class="example"><h3>Example</h3><p><code>
673 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
674 <div class="directive-section"><h2><a name="ProxyPass" id="ProxyPass">ProxyPass</a> <a name="proxypass" id="proxypass">Directive</a></h2>
675 <table class="directive">
676 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps remote servers into the local server URL-space</td></tr>
677 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPass [<var>path</var>] !|<var>url</var> [<var>key=value</var>
678 <var>[key=value</var> ...]]</code></td></tr>
679 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
680 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
681 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
683 <p>This directive allows remote servers to be mapped into the space of
684 the local server; the local server does not act as a proxy in the
685 conventional sense, but appears to be a mirror of the remote
686 server. <var>path</var> is the name of a local virtual path; <var>url</var>
687 is a partial URL for the remote server and cannot include a query
690 <div class="warning">The <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> directive should
691 usually be set <strong>off</strong> when using
692 <code class="directive">ProxyPass</code>.</div>
694 <p>Suppose the local server has address <code>http://example.com/</code>;
697 <div class="example"><p><code>
698 ProxyPass /mirror/foo/ http://backend.example.com/
701 <p>will cause a local request for
702 <code>http://example.com/mirror/foo/bar</code> to be internally converted
703 into a proxy request to <code>http://backend.example.com/bar</code>.</p>
705 <div class="warning">
706 <p>If the first argument ends with a trailing <strong>/</strong>, the second
707 argument should also end with a trailing <strong>/</strong> and vice
708 versa. Otherwise the resulting requests to the backend may miss some
709 needed slashes and do not deliver the expected results.
713 <p>The <code>!</code> directive is useful in situations where you don't want
714 to reverse-proxy a subdirectory, <em>e.g.</em></p>
716 <div class="example"><p><code>
717 ProxyPass /mirror/foo/i !<br />
718 ProxyPass /mirror/foo http://backend.example.com
721 <p>will proxy all requests to <code>/mirror/foo</code> to
722 <code>backend.example.com</code> <em>except</em> requests made to
723 <code>/mirror/foo/i</code>.</p>
725 <div class="note"><h3>Note</h3>
726 <p>Order is important. you need to put the exclusions <em>before</em> the
727 general <code class="directive">ProxyPass</code> directive.</p>
730 <p>As of Apache 2.1, the ability to use pooled connections to a backend
731 server is available. Using the <code>key=value</code> parameters it is
732 possible to tune this connection pooling. The default for a <code>Hard
733 Maximum</code> for the number of connections is the number of threads per
734 process in the active MPM. In the Prefork MPM, this is always 1, while with
735 the Worker MPM it is controlled by the
736 <code class="directive">ThreadsPerChild</code>.</p>
738 <p>Setting <code>min</code> will determine how many connections will always
739 be open to the backend server. Upto the Soft Maximum or <code>smax</code>
740 number of connections will be created on demand. Any connections above
741 <code>smax</code> are subject to a time to live or <code>ttl</code>. Apache
742 will never create more than the Hard Maximum or <code>max</code> connections
743 to the backend server.</p>
745 <div class="example"><p><code>
746 ProxyPass /example http://backend.example.com smax=5 max=20 ttl=120 retry=300
750 <tr><th>Parameter</th>
752 <th>Description</th></tr>
755 <td>Minimum number of connections that will always
756 be open to the backend server.</td></tr>
759 <td>Hard Maximum number of connections that will be
760 allowed to the backend server. The default for a Hard Maximum
761 for the number of connections is the number of threads per process in the
762 active MPM. In the Prefork MPM, this is always 1, while with the Worker MPM
763 it is controlled by the <code class="directive">ThreadsPerChild</code>.
764 Apache will never create more than the Hard Maximum connections
765 to the backend server.</td></tr>
768 <td>Upto the Soft Maximum
769 number of connections will be created on demand. Any connections above
770 <code>smax</code> are subject to a time to live or <code>ttl</code>.
774 <td>If set this will be the maximum time to wait for a free
775 connection in the connection pool. If there are no free connections
776 in the pool the Apache will return <code>SERVER_BUSY</code> status to
779 <tr><td>flushpackets</td>
781 <td>Determines whether the proxy module will auto-flush the output
782 brigade after each "chunk" of data. 'off' means that it will flush
783 only when needed, 'on' means after each chunk is sent and
784 'auto' means poll/wait for a period of time and flush if
785 no input has been received for 'flushwait' milliseconds.
786 Currently this is in effect only for AJP.
788 <tr><td>flushwait</td>
790 <td>The time to wait for additional input, in milliseconds, before
791 flushing the output brigade if 'flushpackets' is 'auto'.
793 <tr><td>keepalive</td>
795 <td>This parameter should be used when you have a firewall between your
796 Apache and the backend server, who tend to drop inactive connections.
797 This flag will tell the Operating System to send <code>KEEP_ALIVE</code>
798 messages on inactive connections (interval depends on global OS settings,
799 generally 120ms), and thus prevent the firewall to drop the connection.
800 To enable keepalive set this property value to <code>On</code>.
804 <td>Sets the load balancer cluster set that the worker is a member
805 of. The load balancer will try all members of a lower numbered
806 lbset before trying higher numbered ones.
810 <td>Ping property tells webserver to send a <code>CPING</code>
811 request on ajp13 connection before forwarding a request.
812 The parameter is the delay in seconds to wait for the
813 <code>CPONG</code> reply.
814 This features has been added to avoid problem with hung and
815 busy Tomcat's and require ajp13 ping/pong support which has
816 been implemented on Tomcat 3.3.2+, 4.1.28+ and 5.0.13+.
817 This will increase the network traffic during the normal operation
818 which could be an issue, but it will lower the
819 traffic in case some of the cluster nodes are down or busy.
820 Currently this has an effect only for AJP.
822 <tr><td>redirect</td>
824 <td>Redirection Route of the worker. This value is usually
825 set dynamically to enable safe removal of the node from
826 the cluster. If set all requests without session id will be
827 redirected to the BalancerMember that has route parametar
832 <td>Connection pool worker retry timeout in seconds.
833 If the connection pool worker to the backend server is in the error state,
834 Apache will not forward any requests to that server until the timeout
835 expires. This enables to shut down the backend server for maintenance,
836 and bring it back online later.
840 <td>Route of the worker when used inside load balancer.
841 The route is a value appended to seesion id.
845 <td>Single letter value defining the initial status of
846 this worker: 'D' is disabled, 'S' is stopped, 'H' is hot-standby
847 and 'E' is in an error state. Status can be set (which is the default)
848 by prepending with '+' or cleared by prepending with '-'.
849 Thus, a setting of 'S-E' sets this worker to Stopped and
850 clears the in-error flag.
853 <td><code class="directive">Timeout</code></td>
854 <td>Connection timeout in seconds.
855 If not set the Apache will wait until the free connection
856 is available. This directive is used for limiting the number
857 of connections to the backend server together with <code>max</code>
862 <td>Time To Live for the inactive connections above the
863 <code>smax</code> connections in seconds. Apache will close all
864 connections that has not been used inside that time period.
869 <p>If the Proxy directive scheme starts with the
870 <code>balancer://</code> then a virtual worker that does not really
871 communicate with the backend server will be created. Instead it is responsible
872 for the management of several "real" workers. In that case the special set of
873 parameters can be add to this virtual worker. See <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code>
874 for more information about how the balancer works.
877 <tr><th>Parameter</th>
879 <th>Description</th></tr>
880 <tr><td>lbmethod</td>
882 <td>Balancer load-balance method. Select the load-balancing scheduler
883 method to use. Either <code>byrequests</code>, to perform weighted
884 request counting or <code>bytraffic</code>, to perform weighted
885 traffic byte count balancing. Default is <code>byrequests</code>.
887 <tr><td>maxattempts</td>
889 <td>Maximum number of failover attempts before giving up.
891 <tr><td>nofailover</td>
893 <td>If set to <code>On</code> the session will break if the worker is in
894 error state or disabled. Set this value to On if backend servers do not
895 support session replication.
897 <tr><td>stickysession</td>
899 <td>Balancer sticky session name. The value is usually set to something
900 like <code>JSESSIONID</code> or <code>PHPSESSIONID</code>,
901 and it depends on the backend application server that support sessions.
902 If the backend application server uses different name for cookies
903 and url encoded id (like servlet containers) use | to to separate them.
904 The first part is for the cookie the second for the path.
908 <td>Balancer timeout in seconds. If set this will be the maximum time
909 to wait for a free worker. Default is not to wait.
913 <p>A sample balancer setup</p>
914 <div class="example"><p><code>
915 ProxyPass /special-area http://special.example.com/ smax=5 max=10<br />
916 ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=On<br />
917 <Proxy balancer://mycluster><br />
918 <span class="indent">
919 BalancerMember http://1.2.3.4:8009<br />
920 BalancerMember http://1.2.3.5:8009 smax=10<br />
921 # Less powerful server, don't send as many requests there<br />
922 BalancerMember http://1.2.3.6:8009 smax=1 loadfactor=20<br />
927 <p>Setting up a hot-standby, that will only be used if no other
928 members are available</p>
929 <div class="example"><p><code>
930 ProxyPass / balancer://hotcluster/ <br />
931 <Proxy balancer://hotcluster><br />
932 <span class="indent">
933 BalancerMember http://1.2.3.4:8009 loadfactor=1<br />
934 BalancerMember http://1.2.3.5:8009 loadfactor=2<br />
935 # The below is the hot standby<br />
936 BalancerMember http://1.2.3.6:8009 status=+H<br />
937 ProxySet lbmethod=bytraffic
943 <p>When used inside a <code class="directive"><a href="../mod/core.html#location"><Location></a></code> section, the first argument is omitted and the local
944 directory is obtained from the <code class="directive"><a href="../mod/core.html#location"><Location></a></code>.</p>
946 <p>If you require a more flexible reverse-proxy configuration, see the
947 <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> directive with the
948 <code>[P]</code> flag.</p>
951 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
952 <div class="directive-section"><h2><a name="ProxyPassInterpolateEnv" id="ProxyPassInterpolateEnv">ProxyPassInterpolateEnv</a> <a name="proxypassinterpolateenv" id="proxypassinterpolateenv">Directive</a></h2>
953 <table class="directive">
954 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable Environment Variable interpolation in Reverse Proxy configurations</td></tr>
955 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassInterpolateEnv On|Off</code></td></tr>
956 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyPassInterpolateEnv Off</code></td></tr>
957 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
958 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
959 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
960 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in trunk only</td></tr>
962 <p>This directive enables reverse proxies to be dynamically
963 configured using environment variables, which may be set by
964 another module such as <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>.
965 It affects the <code class="directive">ProxyPass</code>,
966 <code class="directive">ProxyPassReverse</code>,
967 <code class="directive">ProxyPassReverseCookieDomain</code>, and
968 <code class="directive">ProxyPassReverseCookiePath</code> directives,
969 and causes them to substitute the value of an environment
970 variable <code>varname</code> for the string <code>${varname}</code>
971 in configuration directives.</p>
972 <p>Keep this turned off (for server performance) unless you need it!</p>
975 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
976 <div class="directive-section"><h2><a name="ProxyPassMatch" id="ProxyPassMatch">ProxyPassMatch</a> <a name="proxypassmatch" id="proxypassmatch">Directive</a></h2>
977 <table class="directive">
978 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps remote servers into the local server URL-space using regular expressions</td></tr>
979 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassMatch [<var>regex</var>] !|<var>url</var> [<var>key=value</var>
980 <var>[key=value</var> ...]]</code></td></tr>
981 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
982 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
983 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
985 <p>This directive is equivalent to <code class="directive"><a href="#proxypass">ProxyPass</a></code>,
986 but makes use of regular expressions, instead of simple prefix matching. The
987 supplied regular expression is matched against the <var>url</var>, and if it
988 matches, the server will substitute any parenthesized matches into the given
989 string and use it as a new <var>url</var>.</p>
991 <p>Suppose the local server has address <code>http://example.com/</code>;
994 <div class="example"><p><code>
995 ProxyPassMatch ^(/.*\.gif)$ http://backend.example.com$1
998 <p>will cause a local request for
999 <code>http://example.com/mirror/foo/bar.gif</code> to be internally converted
1000 into a proxy request to <code>http://backend.example.com/foo/bar.gif</code>.</p>
1002 <p>The <code>!</code> directive is useful in situations where you don't want
1003 to reverse-proxy a subdirectory.</p>
1006 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1007 <div class="directive-section"><h2><a name="ProxyPassReverse" id="ProxyPassReverse">ProxyPassReverse</a> <a name="proxypassreverse" id="proxypassreverse">Directive</a></h2>
1008 <table class="directive">
1009 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Adjusts the URL in HTTP response headers sent from a reverse
1010 proxied server</td></tr>
1011 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassReverse [<var>path</var>] <var>url</var></code></td></tr>
1012 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1013 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1014 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1016 <p>This directive lets Apache adjust the URL in the <code>Location</code>,
1017 <code>Content-Location</code> and <code>URI</code> headers on HTTP redirect
1018 responses. This is essential when Apache is used as a reverse proxy to avoid
1019 by-passing the reverse proxy because of HTTP redirects on the backend
1020 servers which stay behind the reverse proxy.</p>
1022 <p>Only the HTTP response headers specifically mentioned above
1023 will be rewritten. Apache will not rewrite other response
1024 headers, nor will it rewrite URL references inside HTML pages.
1025 This means that if the proxied content contains absolute URL
1026 references, they will by-pass the proxy. A third-party module
1027 that will look inside the HTML and rewrite URL references is Nick
1028 Kew's <a href="http://apache.webthing.com/mod_proxy_html/">mod_proxy_html</a>.</p>
1030 <p><var>path</var> is the name of a local virtual path. <var>url</var> is a
1031 partial URL for the remote server - the same way they are used for the
1032 <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive.</p>
1034 <p>For example, suppose the local server has address
1035 <code>http://example.com/</code>; then</p>
1037 <div class="example"><p><code>
1038 ProxyPass /mirror/foo/ http://backend.example.com/<br />
1039 ProxyPassReverse /mirror/foo/ http://backend.example.com/<br />
1040 ProxyPassReverseCookieDomain backend.example.com public.example.com<br />
1041 ProxyPassReverseCookiePath / /mirror/foo/
1044 <p>will not only cause a local request for the
1045 <code>http://example.com/mirror/foo/bar</code> to be internally converted
1046 into a proxy request to <code>http://backend.example.com/bar</code>
1047 (the functionality <code>ProxyPass</code> provides here). It also takes care
1048 of redirects the server <code>backend.example.com</code> sends: when
1049 <code>http://backend.example.com/bar</code> is redirected by him to
1050 <code>http://backend.example.com/quux</code> Apache adjusts this to
1051 <code>http://example.com/mirror/foo/quux</code> before forwarding the HTTP
1052 redirect response to the client. Note that the hostname used for
1053 constructing the URL is chosen in respect to the setting of the <code class="directive"><a href="../mod/core.html#usecanonicalname">UseCanonicalName</a></code> directive.</p>
1055 <p>Note that this <code class="directive">ProxyPassReverse</code> directive can
1056 also be used in conjunction with the proxy pass-through feature
1057 (<code>RewriteRule ... [P]</code>) from <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
1058 because it doesn't depend on a corresponding <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive.</p>
1060 <p>When used inside a <code class="directive"><a href="../mod/core.html#location"><Location></a></code> section, the first argument is omitted and the local
1061 directory is obtained from the <code class="directive"><a href="../mod/core.html#location"><Location></a></code>.</p>
1064 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1065 <div class="directive-section"><h2><a name="ProxyPassReverseCookieDomain" id="ProxyPassReverseCookieDomain">ProxyPassReverseCookieDomain</a> <a name="proxypassreversecookiedomain" id="proxypassreversecookiedomain">Directive</a></h2>
1066 <table class="directive">
1067 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Adjusts the Domain string in Set-Cookie headers from a reverse-
1068 proxied server</td></tr>
1069 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassReverseCookieDomain <var>internal-domain</var> <var>public-domain</var></code></td></tr>
1070 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1071 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1072 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1074 <p>Usage is basically similar to
1075 <code class="directive"><a href="#proxypassreverse">ProxyPassReverse</a></code>, but instead of
1076 rewriting headers that are a URL, this rewrites the <code>domain</code>
1077 string in <code>Set-Cookie</code> headers.</p>
1080 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1081 <div class="directive-section"><h2><a name="ProxyPassReverseCookiePath" id="ProxyPassReverseCookiePath">ProxyPassReverseCookiePath</a> <a name="proxypassreversecookiepath" id="proxypassreversecookiepath">Directive</a></h2>
1082 <table class="directive">
1083 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Adjusts the Path string in Set-Cookie headers from a reverse-
1084 proxied server</td></tr>
1085 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassReverseCookiePath <var>internal-path</var> <var>public-path</var></code></td></tr>
1086 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1087 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1088 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1090 <p>Usage is basically similar to
1091 <code class="directive"><a href="#proxypassreverse">ProxyPassReverse</a></code>, but instead of
1092 rewriting headers that are a URL, this rewrites the <code>path</code>
1093 string in <code>Set-Cookie</code> headers.</p>
1096 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1097 <div class="directive-section"><h2><a name="ProxyPreserveHost" id="ProxyPreserveHost">ProxyPreserveHost</a> <a name="proxypreservehost" id="proxypreservehost">Directive</a></h2>
1098 <table class="directive">
1099 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use incoming Host HTTP request header for proxy
1101 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPreserveHost On|Off</code></td></tr>
1102 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyPreserveHost Off</code></td></tr>
1103 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1104 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1105 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1106 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.31 and later.</td></tr>
1108 <p>When enabled, this option will pass the Host: line from the incoming
1109 request to the proxied host, instead of the hostname specified in the
1110 <code class="directive">ProxyPass</code> line.</p>
1112 <p>This option should normally be turned <code>Off</code>. It is mostly
1113 useful in special configurations like proxied mass name-based virtual
1114 hosting, where the original Host header needs to be evaluated by the
1118 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1119 <div class="directive-section"><h2><a name="ProxyReceiveBufferSize" id="ProxyReceiveBufferSize">ProxyReceiveBufferSize</a> <a name="proxyreceivebuffersize" id="proxyreceivebuffersize">Directive</a></h2>
1120 <table class="directive">
1121 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Network buffer size for proxied HTTP and FTP
1122 connections</td></tr>
1123 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyReceiveBufferSize <var>bytes</var></code></td></tr>
1124 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyReceiveBufferSize 0</code></td></tr>
1125 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1126 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1127 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1129 <p>The <code class="directive">ProxyReceiveBufferSize</code> directive specifies an
1130 explicit (TCP/IP) network buffer size for proxied HTTP and FTP connections,
1131 for increased throughput. It has to be greater than <code>512</code> or set
1132 to <code>0</code> to indicate that the system's default buffer size should
1135 <div class="example"><h3>Example</h3><p><code>
1136 ProxyReceiveBufferSize 2048
1140 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1141 <div class="directive-section"><h2><a name="ProxyRemote" id="ProxyRemote">ProxyRemote</a> <a name="proxyremote" id="proxyremote">Directive</a></h2>
1142 <table class="directive">
1143 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Remote proxy used to handle certain requests</td></tr>
1144 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyRemote <var>match</var> <var>remote-server</var></code></td></tr>
1145 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1146 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1147 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1149 <p>This defines remote proxies to this proxy. <var>match</var> is either the
1150 name of a URL-scheme that the remote server supports, or a partial URL
1151 for which the remote server should be used, or <code>*</code> to indicate
1152 the server should be contacted for all requests. <var>remote-server</var> is
1153 a partial URL for the remote server. Syntax:</p>
1155 <div class="example"><p><code>
1156 <dfn>remote-server</dfn> =
1157 <var>scheme</var>://<var>hostname</var>[:<var>port</var>]
1160 <p><var>scheme</var> is effectively the protocol that should be used to
1161 communicate with the remote server; only <code>http</code> is supported by
1164 <div class="example"><h3>Example</h3><p><code>
1165 ProxyRemote http://goodguys.com/ http://mirrorguys.com:8000<br />
1166 ProxyRemote * http://cleversite.com<br />
1167 ProxyRemote ftp http://ftpproxy.mydomain.com:8080
1170 <p>In the last example, the proxy will forward FTP requests, encapsulated
1171 as yet another HTTP proxy request, to another proxy which can handle
1174 <p>This option also supports reverse proxy configuration - a backend
1175 webserver can be embedded within a virtualhost URL space even if that
1176 server is hidden by another forward proxy.</p>
1179 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1180 <div class="directive-section"><h2><a name="ProxyRemoteMatch" id="ProxyRemoteMatch">ProxyRemoteMatch</a> <a name="proxyremotematch" id="proxyremotematch">Directive</a></h2>
1181 <table class="directive">
1182 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Remote proxy used to handle requests matched by regular
1183 expressions</td></tr>
1184 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyRemoteMatch <var>regex</var> <var>remote-server</var></code></td></tr>
1185 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1186 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1187 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1189 <p>The <code class="directive">ProxyRemoteMatch</code> is identical to the
1190 <code class="directive"><a href="#proxyremote">ProxyRemote</a></code> directive, except the
1191 first argument is a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>
1192 match against the requested URL.</p>
1195 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1196 <div class="directive-section"><h2><a name="ProxyRequests" id="ProxyRequests">ProxyRequests</a> <a name="proxyrequests" id="proxyrequests">Directive</a></h2>
1197 <table class="directive">
1198 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables forward (standard) proxy requests</td></tr>
1199 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyRequests On|Off</code></td></tr>
1200 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyRequests Off</code></td></tr>
1201 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1202 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1203 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1205 <p>This allows or prevents Apache from functioning as a forward proxy
1206 server. (Setting ProxyRequests to <code>Off</code> does not disable use of
1207 the <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive.)</p>
1209 <p>In a typical reverse proxy configuration, this option should be set to
1210 <code>Off</code>.</p>
1212 <p>In order to get the functionality of proxying HTTP or FTP sites, you
1213 need also <code class="module"><a href="../mod/mod_proxy_http.html">mod_proxy_http</a></code> or <code class="module"><a href="../mod/mod_proxy_ftp.html">mod_proxy_ftp</a></code>
1214 (or both) present in the server.</p>
1216 <div class="warning"><h3>Warning</h3>
1217 <p>Do not enable proxying with <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> until you have <a href="#access">secured your server</a>. Open proxy servers are dangerous
1218 both to your network and to the Internet at large.</p>
1222 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1223 <div class="directive-section"><h2><a name="ProxyTimeout" id="ProxyTimeout">ProxyTimeout</a> <a name="proxytimeout" id="proxytimeout">Directive</a></h2>
1224 <table class="directive">
1225 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Network timeout for proxied requests</td></tr>
1226 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyTimeout <var>seconds</var></code></td></tr>
1227 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyTimeout 300</code></td></tr>
1228 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1229 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1230 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1231 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache 2.0.31 and later</td></tr>
1233 <p>This directive allows a user to specifiy a timeout on proxy requests.
1234 This is useful when you have a slow/buggy appserver which hangs, and you
1235 would rather just return a timeout and fail gracefully instead of waiting
1236 however long it takes the server to return.</p>
1239 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1240 <div class="directive-section"><h2><a name="ProxyVia" id="ProxyVia">ProxyVia</a> <a name="proxyvia" id="proxyvia">Directive</a></h2>
1241 <table class="directive">
1242 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Information provided in the <code>Via</code> HTTP response
1243 header for proxied requests</td></tr>
1244 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyVia On|Off|Full|Block</code></td></tr>
1245 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyVia Off</code></td></tr>
1246 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1247 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1248 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1250 <p>This directive controls the use of the <code>Via:</code> HTTP
1251 header by the proxy. Its intended use is to control the flow of
1252 proxy requests along a chain of proxy servers. See <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> (HTTP/1.1), section
1253 14.45 for an explanation of <code>Via:</code> header lines.</p>
1256 <li>If set to <code>Off</code>, which is the default, no special processing
1257 is performed. If a request or reply contains a <code>Via:</code> header,
1258 it is passed through unchanged.</li>
1260 <li>If set to <code>On</code>, each request and reply will get a
1261 <code>Via:</code> header line added for the current host.</li>
1263 <li>If set to <code>Full</code>, each generated <code>Via:</code> header
1264 line will additionally have the Apache server version shown as a
1265 <code>Via:</code> comment field.</li>
1267 <li>If set to <code>Block</code>, every proxy request will have all its
1268 <code>Via:</code> header lines removed. No new <code>Via:</code> header will
1274 <div class="bottomlang">
1275 <p><span>Available Languages: </span><a href="../en/mod/mod_proxy.html" title="English"> en </a> |
1276 <a href="../ja/mod/mod_proxy.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
1277 </div><div id="footer">
1278 <p class="apache">Copyright 2006 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
1279 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>