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="../fr/mod/mod_proxy.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
26 <a href="../ja/mod/mod_proxy.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
28 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>HTTP/1.1 proxy/gateway server</td></tr>
29 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
30 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>proxy_module</td></tr>
31 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_proxy.c</td></tr></table>
34 <div class="warning"><h3>Warning</h3>
35 <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
36 network and to the Internet at large.</p>
39 <p>This module implements a proxy/gateway for Apache HTTP Server. It implements
40 proxying capability for <code>AJP13</code> (Apache JServe Protocol
41 version 1.3), <code>FTP</code>, <code>CONNECT</code> (for SSL),
42 <code>HTTP/0.9</code>, <code>HTTP/1.0</code>, and <code>HTTP/1.1</code>.
43 The module can be configured to connect to other proxy modules for these
44 and other protocols.</p>
46 <p>Apache httpd's proxy features are divided into several modules in
47 addition to <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code>:
48 <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>,
49 <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>,
50 and <code class="module"><a href="../mod/mod_proxy_connect.html">mod_proxy_connect</a></code>. Thus, if you want to use
51 one or more of the particular proxy functions, load
52 <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> <em>and</em> the appropriate module(s)
53 into the server (either statically at compile-time or dynamically
54 via the <code class="directive"><a href="../mod/mod_so.html#loadmodule">LoadModule</a></code>
57 <p>In addition, extended features are provided by other modules.
58 Caching is provided by <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code> and related
59 modules. The ability to contact remote servers using the SSL/TLS
60 protocol is provided by the <code>SSLProxy*</code> directives of
61 <code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code>. These additional modules will need
62 to be loaded and configured to take advantage of these features.</p>
64 <div id="quickview"><h3 class="directives">Directives</h3>
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="#proxyset">ProxySet</a></li>
88 <li><img alt="" src="../images/down.gif" /> <a href="#proxystatus">ProxyStatus</a></li>
89 <li><img alt="" src="../images/down.gif" /> <a href="#proxytimeout">ProxyTimeout</a></li>
90 <li><img alt="" src="../images/down.gif" /> <a href="#proxyvia">ProxyVia</a></li>
94 <li><img alt="" src="../images/down.gif" /> <a href="#forwardreverse">Forward Proxies and Reverse
95 Proxies/Gateways</a></li>
96 <li><img alt="" src="../images/down.gif" /> <a href="#examples">Basic Examples</a></li>
97 <li><img alt="" src="../images/down.gif" /> <a href="#workers">Workers</a></li>
98 <li><img alt="" src="../images/down.gif" /> <a href="#access">Controlling access to your proxy</a></li>
99 <li><img alt="" src="../images/down.gif" /> <a href="#startup">Slow Startup</a></li>
100 <li><img alt="" src="../images/down.gif" /> <a href="#intranet">Intranet Proxy</a></li>
101 <li><img alt="" src="../images/down.gif" /> <a href="#envsettings">Protocol Adjustments</a></li>
102 <li><img alt="" src="../images/down.gif" /> <a href="#request-bodies">Request Bodies</a></li>
103 <li><img alt="" src="../images/down.gif" /> <a href="#x-headers">Reverse Proxy Request Headers</a></li>
104 </ul><h3>See also</h3>
106 <li><code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code></li>
107 <li><code class="module"><a href="../mod/mod_proxy_http.html">mod_proxy_http</a></code></li>
108 <li><code class="module"><a href="../mod/mod_proxy_ftp.html">mod_proxy_ftp</a></code></li>
109 <li><code class="module"><a href="../mod/mod_proxy_connect.html">mod_proxy_connect</a></code></li>
110 <li><code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code></li>
111 <li><code class="module"><a href="../mod/mod_ssl.html">mod_ssl</a></code></li>
113 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
114 <div class="section">
115 <h2><a name="forwardreverse" id="forwardreverse">Forward Proxies and Reverse
116 Proxies/Gateways</a></h2>
117 <p>Apache HTTP Server can be configured in both a <dfn>forward</dfn> and
118 <dfn>reverse</dfn> proxy (also known as <dfn>gateway</dfn>) mode.</p>
120 <p>An ordinary <dfn>forward proxy</dfn> is an intermediate
121 server that sits between the client and the <em>origin
122 server</em>. In order to get content from the origin server,
123 the client sends a request to the proxy naming the origin server
124 as the target and the proxy then requests the content from the
125 origin server and returns it to the client. The client must be
126 specially configured to use the forward proxy to access other
129 <p>A typical usage of a forward proxy is to provide Internet
130 access to internal clients that are otherwise restricted by a
131 firewall. The forward proxy can also use caching (as provided
132 by <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code>) to reduce network usage.</p>
134 <p>The forward proxy is activated using the <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> directive. Because
135 forward proxies allow clients to access arbitrary sites through
136 your server and to hide their true origin, it is essential that
137 you <a href="#access">secure your server</a> so that only
138 authorized clients can access the proxy before activating a
141 <p>A <dfn>reverse proxy</dfn> (or <dfn>gateway</dfn>), by
142 contrast, appears to the client just like an ordinary web
143 server. No special configuration on the client is necessary.
144 The client makes ordinary requests for content in the name-space
145 of the reverse proxy. The reverse proxy then decides where to
146 send those requests, and returns the content as if it was itself
149 <p>A typical usage of a reverse proxy is to provide Internet
150 users access to a server that is behind a firewall. Reverse
151 proxies can also be used to balance load among several back-end
152 servers, or to provide caching for a slower back-end server.
153 In addition, reverse proxies can be used simply to bring
154 several servers into the same URL space.</p>
156 <p>A reverse proxy is activated using the <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive or the
157 <code>[P]</code> flag to the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> directive. It is
158 <strong>not</strong> necessary to turn <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> on in order to
159 configure a reverse proxy.</p>
160 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
161 <div class="section">
162 <h2><a name="examples" id="examples">Basic Examples</a></h2>
164 <p>The examples below are only a very basic idea to help you
165 get started. Please read the documentation on the individual
168 <p>In addition, if you wish to have caching enabled, consult
169 the documentation from <code class="module"><a href="../mod/mod_cache.html">mod_cache</a></code>.</p>
171 <div class="example"><h3>Reverse Proxy</h3><p><code>
172 ProxyPass /foo http://foo.example.com/bar<br />
173 ProxyPassReverse /foo http://foo.example.com/bar
176 <div class="example"><h3>Forward Proxy</h3><p><code>
177 ProxyRequests On<br />
180 <Proxy *><br />
181 <span class="indent">
182 Require host internal.example.com<br />
186 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
187 <div class="section">
188 <h2><a name="workers" id="workers">Workers</a></h2>
189 <p>The proxy manages the configuration of origin servers and their
190 communication parameters in objects called <dfn>workers</dfn>.
191 There are two built-in workers, the default forward proxy worker and the
192 default reverse proxy worker. Additional workers can be configured
195 <p>The two default workers have a fixed configuration
196 and will be used if no other worker matches the request.
197 They do not use HTTP Keep-Alive or connection pooling.
198 The TCP connections to the origin server will instead be
199 opened and closed for each request.</p>
201 <p>Explicitly configured workers are identified by their URL.
202 They are usually created and configured using
203 <code class="directive"><a href="#proxypass">ProxyPass</a></code> or
204 <code class="directive"><a href="#proxypassmatch">ProxyPassMatch</a></code> when used
205 for a reverse proxy:</p>
207 <div class="example"><p><code>
208 ProxyPass /example http://backend.example.com connectiontimeout=5 timeout=30
211 <p>This will create a worker associated with the origin server URL
212 <code>http://backend.example.com</code> and using the given timeout
213 values. When used in a forward proxy, workers are usually defined
214 via the <code class="directive"><a href="#proxyset">ProxySet</a></code> directive:</p>
216 <div class="example"><p><code>
217 ProxySet http://backend.example.com connectiontimeout=5 timeout=30
220 <p>or alternatively using <code class="directive"><a href="#proxy">Proxy</a></code>
221 and <code class="directive"><a href="#proxyset">ProxySet</a></code>:</p>
223 <div class="example"><p><code>
224 <Proxy http://backend.example.com><br />
225 <span class="indent">
226 ProxySet connectiontimeout=5 timeout=30
231 <p>Using explicitly configured workers in the forward mode is
232 not very common, because forward proxies usually communicate with many
233 different origin servers. Creating explicit workers for some of the
234 origin servers can still be useful, if they are used very often.
235 Explicitly configured workers have no concept of forward or reverse
236 proxying by themselves. They encapsulate a common concept of
237 communication with origin servers. A worker created by
238 <code class="directive"><a href="#proxypass">ProxyPass</a></code> for use in a
239 reverse proxy will be also used for forward proxy requests whenever
240 the URL to the origin server matches the worker URL and vice versa.</p>
242 <p>The URL identifying a direct worker is the URL of its
243 origin server including any path components given:</p>
245 <div class="example"><p><code>
246 ProxyPass /examples http://backend.example.com/examples<br />
247 ProxyPass /docs http://backend.example.com/docs
250 <p>This example defines two different workers, each using a separate
251 connection pool and configuration.</p>
253 <div class="warning"><h3>Worker Sharing</h3>
254 <p>Worker sharing happens if the worker URLs overlap, which occurs when
255 the URL of some worker is a leading substring of the URL of another
256 worker defined later in the configuration file. In the following example</p>
258 <div class="example"><p><code>
259 ProxyPass /apps http://backend.example.com/ timeout=60<br />
260 ProxyPass /examples http://backend.example.com/examples timeout=10
263 <p>the second worker isn't actually created. Instead the first
264 worker is used. The benefit is, that there is only one connection pool,
265 so connections are more often reused. Note that all configuration attributes
266 given explicitly for the later worker will be ignored. This will be logged
267 as a warning. In the above example the resulting timeout value
268 for the URL <code>/examples</code> will be <code>60</code> instead
269 of <code>10</code>!</p>
271 <p>If you want to avoid worker sharing, sort your worker definitions
272 by URL length, starting with the longest worker URLs. If you want to maximize
273 worker sharing use the reverse sort order. See also the related warning about
274 ordering <code class="directive"><a href="#proxypass">ProxyPass</a></code> directives.</p>
278 <p>Explicitly configured workers come in two flavors:
279 <dfn>direct workers</dfn> and <dfn>(load) balancer workers</dfn>.
280 They support many important configuration attributes which are
281 described below in the <code class="directive"><a href="#proxypass">ProxyPass</a></code>
282 directive. The same attributes can also be set using
283 <code class="directive"><a href="#proxyset">ProxySet</a></code>.</p>
285 <p>The set of options available for a direct worker
286 depends on the protocol, which is specified in the origin server URL.
287 Available protocols include <code>ajp</code>, <code>fcgi</code>,
288 <code>ftp</code>, <code>http</code> and <code>scgi</code>.</p>
290 <p>Balancer workers are virtual workers that use direct workers known
291 as their members to actually handle the requests. Each balancer can
292 have multiple members. When it handles a request, it chooses a member
293 based on the configured load balancing algorithm.</p>
295 <p>A balancer worker is created if its worker URL uses
296 <code>balancer</code> as the protocol scheme.
297 The balancer URL uniquely identifies the balancer worker.
298 Members are added to a balancer using
299 <code class="directive"><a href="#balancermember">BalancerMember</a></code>.</p>
301 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
302 <div class="section">
303 <h2><a name="access" id="access">Controlling access to your proxy</a></h2>
304 <p>You can control who can access your proxy via the <code class="directive"><a href="#proxy"><Proxy></a></code> control block as in
305 the following example:</p>
307 <div class="example"><p><code>
308 <Proxy *><br />
309 <span class="indent">
310 Require ip 192.168.0<br />
315 <p>For more information on access control directives, see
316 <code class="module"><a href="../mod/mod_authz_host.html">mod_authz_host</a></code>.</p>
318 <p>Strictly limiting access is essential if you are using a
319 forward proxy (using the <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> directive).
320 Otherwise, your server can be used by any client to access
321 arbitrary hosts while hiding his or her true identity. This is
322 dangerous both for your network and for the Internet at large.
323 When using a reverse proxy (using the <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive with
324 <code>ProxyRequests Off</code>), access control is less
325 critical because clients can only contact the hosts that you
326 have specifically configured.</p>
328 <p><strong>See Also</strong> the <a href="mod_proxy_http.html#env">Proxy-Chain-Auth</a> environment variable.</p>
330 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
331 <div class="section">
332 <h2><a name="startup" id="startup">Slow Startup</a></h2>
333 <p>If you're using the <code class="directive"><a href="#proxyblock">ProxyBlock</a></code> directive, hostnames' IP addresses are looked up
334 and cached during startup for later match test. This may take a few
335 seconds (or more) depending on the speed with which the hostname lookups
337 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
338 <div class="section">
339 <h2><a name="intranet" id="intranet">Intranet Proxy</a></h2>
340 <p>An Apache httpd proxy server situated in an intranet needs to forward
341 external requests through the company's firewall (for this, configure
342 the <code class="directive"><a href="#proxyremote">ProxyRemote</a></code> directive
343 to forward the respective <var>scheme</var> to the firewall proxy).
344 However, when it has to
345 access resources within the intranet, it can bypass the firewall when
346 accessing hosts. The <code class="directive"><a href="#noproxy">NoProxy</a></code>
347 directive is useful for specifying which hosts belong to the intranet and
348 should be accessed directly.</p>
350 <p>Users within an intranet tend to omit the local domain name from their
351 WWW requests, thus requesting "http://somehost/" instead of
352 <code>http://somehost.example.com/</code>. Some commercial proxy servers
353 let them get away with this and simply serve the request, implying a
354 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 httpd can return
355 a redirect response and send the client to the correct, fully qualified,
356 server address. This is the preferred method since the user's bookmark
357 files will then contain fully qualified hosts.</p>
358 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
359 <div class="section">
360 <h2><a name="envsettings" id="envsettings">Protocol Adjustments</a></h2>
361 <p>For circumstances where <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> is sending
362 requests to an origin server that doesn't properly implement
363 keepalives or HTTP/1.1, there are two <a href="../env.html">environment variables</a> that can force the
364 request to use HTTP/1.0 with no keepalive. These are set via the
365 <code class="directive"><a href="../mod/mod_env.html#setenv">SetEnv</a></code> directive.</p>
367 <p>These are the <code>force-proxy-request-1.0</code> and
368 <code>proxy-nokeepalive</code> notes.</p>
370 <div class="example"><p><code>
371 <Location /buggyappserver/><br />
372 <span class="indent">
373 ProxyPass http://buggyappserver:7001/foo/<br />
374 SetEnv force-proxy-request-1.0 1<br />
375 SetEnv proxy-nokeepalive 1<br />
380 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
381 <div class="section">
382 <h2><a name="request-bodies" id="request-bodies">Request Bodies</a></h2>
384 <p>Some request methods such as POST include a request body.
385 The HTTP protocol requires that requests which include a body
386 either use chunked transfer encoding or send a
387 <code>Content-Length</code> request header. When passing these
388 requests on to the origin server, <code class="module"><a href="../mod/mod_proxy_http.html">mod_proxy_http</a></code>
389 will always attempt to send the <code>Content-Length</code>. But
390 if the body is large and the original request used chunked
391 encoding, then chunked encoding may also be used in the upstream
392 request. You can control this selection using <a href="../env.html">environment variables</a>. Setting
393 <code>proxy-sendcl</code> ensures maximum compatibility with
394 upstream servers by always sending the
395 <code>Content-Length</code>, while setting
396 <code>proxy-sendchunked</code> minimizes resource usage by using
397 chunked encoding.</p>
399 <p>Under some circumstances, the server must spool request bodies
400 to disk to satisfy the requested handling of request bodies. For
401 example, this spooling will occur if the original body was sent with
402 chunked encoding (and is large), but the administrator has
403 asked for backend requests to be sent with Content-Length or as HTTP/1.0.
404 This spooling can also occur if the request body already has a
405 Content-Length header, but the server is configured to filter incoming
408 <p><code class="directive"><a href="../mod/core.html#limitrequestbody">LimitRequestBody</a></code> only applies to
409 request bodies that the server will spool to disk</p>
411 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
412 <div class="section">
413 <h2><a name="x-headers" id="x-headers">Reverse Proxy Request Headers</a></h2>
415 <p>When acting in a reverse-proxy mode (using the <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive, for example),
416 <code class="module"><a href="../mod/mod_proxy_http.html">mod_proxy_http</a></code> adds several request headers in
417 order to pass information to the origin server. These headers
421 <dt><code>X-Forwarded-For</code></dt>
422 <dd>The IP address of the client.</dd>
423 <dt><code>X-Forwarded-Host</code></dt>
424 <dd>The original host requested by the client in the <code>Host</code>
425 HTTP request header.</dd>
426 <dt><code>X-Forwarded-Server</code></dt>
427 <dd>The hostname of the proxy server.</dd>
430 <p>Be careful when using these headers on the origin server, since
431 they will contain more than one (comma-separated) value if the
432 original request already contained one of these headers. For
433 example, you can use <code>%{X-Forwarded-For}i</code> in the log
434 format string of the origin server to log the original clients IP
435 address, but you may get more than one address if the request
436 passes through several proxies.</p>
438 <p>See also the <code class="directive"><a href="#proxypreservehost">ProxyPreserveHost</a></code> and <code class="directive"><a href="#proxyvia">ProxyVia</a></code> directives, which control
439 other request headers.</p>
442 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
443 <div class="directive-section"><h2><a name="BalancerMember" id="BalancerMember">BalancerMember</a> <a name="balancermember" id="balancermember">Directive</a></h2>
444 <table class="directive">
445 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Add a member to a load balancing group</td></tr>
446 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>BalancerMember [<var>balancerurl</var>] <var>url</var> [<var>key=value [key=value ...]]</var></code></td></tr>
447 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
448 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
449 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
450 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>BalancerMember is only available in Apache HTTP Server 2.2
453 <p>This directive adds a member to a load balancing group. It could be used
454 within a <code><Proxy <var>balancer://</var>...></code> container
455 directive, and can take any of the key value pair parameters available to
456 <code class="directive"><a href="#proxypass">ProxyPass</a></code> directives.</p>
457 <p>One additional parameter is available only to <code class="directive"><a href="#balancermember">BalancerMember</a></code> directives:
458 <var>loadfactor</var>. This is the member load factor - a number between 1
459 (default) and 100, which defines the weighted load to be applied to the
460 member in question.</p>
461 <p>The balancerurl is only needed when not in <code><Proxy <var>balancer://</var>...></code>
462 container directive. It corresponds to the url of a balancer defined in
463 <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive.</p>
466 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
467 <div class="directive-section"><h2><a name="NoProxy" id="NoProxy">NoProxy</a> <a name="noproxy" id="noproxy">Directive</a></h2>
468 <table class="directive">
469 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Hosts, domains, or networks that will be connected to
471 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>NoProxy <var>host</var> [<var>host</var>] ...</code></td></tr>
472 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
473 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
474 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
476 <p>This directive is only useful for Apache httpd proxy servers within
477 intranets. The <code class="directive">NoProxy</code> directive specifies a
478 list of subnets, IP addresses, hosts and/or domains, separated by
479 spaces. A request to a host which matches one or more of these is
480 always served directly, without forwarding to the configured
481 <code class="directive"><a href="#proxyremote">ProxyRemote</a></code> proxy server(s).</p>
483 <div class="example"><h3>Example</h3><p><code>
484 ProxyRemote * http://firewall.example.com:81<br />
485 NoProxy .example.com 192.168.112.0/21
488 <p>The <var>host</var> arguments to the <code class="directive">NoProxy</code>
489 directive are one of the following type list:</p>
493 <dt><var><a name="domain" id="domain">Domain</a></var></dt>
495 <p>A <dfn>Domain</dfn> is a partially qualified DNS domain name, preceded
496 by a period. It represents a list of hosts which logically belong to the
497 same DNS domain or zone (<em>i.e.</em>, the suffixes of the hostnames are
498 all ending in <var>Domain</var>).</p>
500 <div class="example"><h3>Examples</h3><p><code>
504 <p>To distinguish <var>Domain</var>s from <var><a href="#hostname">Hostname</a></var>s (both syntactically and semantically; a DNS domain can
505 have a DNS A record, too!), <var>Domain</var>s are always written with a
508 <div class="note"><h3>Note</h3>
509 <p>Domain name comparisons are done without regard to the case, and
510 <var>Domain</var>s are always assumed to be anchored in the root of the
511 DNS tree, therefore two domains <code>.ExAmple.com</code> and
512 <code>.example.com.</code> (note the trailing period) are considered
513 equal. Since a domain comparison does not involve a DNS lookup, it is much
514 more efficient than subnet comparison.</p>
518 <dt><var><a name="subnet" id="subnet">SubNet</a></var></dt>
520 <p>A <dfn>SubNet</dfn> is a partially qualified internet address in
521 numeric (dotted quad) form, optionally followed by a slash and the netmask,
522 specified as the number of significant bits in the <var>SubNet</var>. It is
523 used to represent a subnet of hosts which can be reached over a common
524 network interface. In the absence of the explicit net mask it is assumed
525 that omitted (or zero valued) trailing digits specify the mask. (In this
526 case, the netmask can only be multiples of 8 bits wide.) Examples:</p>
529 <dt><code>192.168</code> or <code>192.168.0.0</code></dt>
530 <dd>the subnet 192.168.0.0 with an implied netmask of 16 valid bits
531 (sometimes used in the netmask form <code>255.255.0.0</code>)</dd>
532 <dt><code>192.168.112.0/21</code></dt>
533 <dd>the subnet <code>192.168.112.0/21</code> with a netmask of 21
534 valid bits (also used in the form <code>255.255.248.0</code>)</dd>
537 <p>As a degenerate case, a <em>SubNet</em> with 32 valid bits is the
538 equivalent to an <var><a href="#ipadr">IPAddr</a></var>, while a <var>SubNet</var> with zero
539 valid bits (<em>e.g.</em>, 0.0.0.0/0) is the same as the constant
540 <var>_Default_</var>, matching any IP address.</p></dd>
543 <dt><var><a name="ipaddr" id="ipaddr">IPAddr</a></var></dt>
545 <p>A <dfn>IPAddr</dfn> represents a fully qualified internet address in
546 numeric (dotted quad) form. Usually, this address represents a host, but
547 there need not necessarily be a DNS domain name connected with the
549 <div class="example"><h3>Example</h3><p><code>
553 <div class="note"><h3>Note</h3>
554 <p>An <var>IPAddr</var> does not need to be resolved by the DNS system, so
555 it can result in more effective apache performance.</p>
559 <dt><var><a name="hostname" id="hostname">Hostname</a></var></dt>
561 <p>A <dfn>Hostname</dfn> is a fully qualified DNS domain name which can
562 be resolved to one or more <var><a href="#ipaddr">IPAddrs</a></var> via the
563 DNS domain name service. It represents a logical host (in contrast to
564 <var><a href="#domain">Domain</a></var>s, see above) and must be resolvable
565 to at least one <var><a href="#ipaddr">IPAddr</a></var> (or often to a list
566 of hosts with different <var><a href="#ipaddr">IPAddr</a></var>s).</p>
568 <div class="example"><h3>Examples</h3><p><code>
569 prep.ai.example.com<br />
573 <div class="note"><h3>Note</h3>
574 <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
575 DNS lookup can be avoided. Name resolution in Apache httpd can take a remarkable
576 deal of time when the connection to the name server uses a slow PPP
578 <p><var>Hostname</var> comparisons are done without regard to the case,
579 and <var>Hostname</var>s are always assumed to be anchored in the root
580 of the DNS tree, therefore two hosts <code>WWW.ExAmple.com</code>
581 and <code>www.example.com.</code> (note the trailing period) are
582 considered equal.</p>
588 <li><a href="../dns-caveats.html">DNS Issues</a></li>
591 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
592 <div class="directive-section"><h2><a name="Proxy" id="Proxy"><Proxy></a> <a name="proxy" id="proxy">Directive</a></h2>
593 <table class="directive">
594 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Container for directives applied to proxied resources</td></tr>
595 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><Proxy <var>wildcard-url</var>> ...</Proxy></code></td></tr>
596 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
597 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
598 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
600 <p>Directives placed in <code class="directive"><Proxy></code>
601 sections apply only to matching proxied content. Shell-style wildcards are
604 <p>For example, the following will allow only hosts in
605 <code>yournetwork.example.com</code> to access content via your proxy
608 <div class="example"><p><code>
609 <Proxy *><br />
610 <span class="indent">
611 Require host yournetwork.example.com<br />
616 <p>The following example will process all files in the <code>foo</code>
617 directory of <code>example.com</code> through the <code>INCLUDES</code>
618 filter when they are sent through the proxy server:</p>
620 <div class="example"><p><code>
621 <Proxy http://example.com/foo/*><br />
622 <span class="indent">
623 SetOutputFilter INCLUDES<br />
631 <li><code class="directive"><a href="#proxymatch"><ProxyMatch></a></code></li>
634 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
635 <div class="directive-section"><h2><a name="ProxyBadHeader" id="ProxyBadHeader">ProxyBadHeader</a> <a name="proxybadheader" id="proxybadheader">Directive</a></h2>
636 <table class="directive">
637 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines how to handle bad header lines in a
639 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyBadHeader IsError|Ignore|StartBody</code></td></tr>
640 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyBadHeader IsError</code></td></tr>
641 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
642 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
643 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
644 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.0.44 and later</td></tr>
646 <p>The <code class="directive">ProxyBadHeader</code> directive determines the
647 behaviour of <code class="module"><a href="../mod/mod_proxy.html">mod_proxy</a></code> if it receives syntactically invalid
648 response header lines (<em>i.e.</em> containing no colon) from the origin
649 server. The following arguments are possible:</p>
652 <dt><code>IsError</code></dt>
653 <dd>Abort the request and end up with a 502 (Bad Gateway) response. This is
654 the default behaviour.</dd>
656 <dt><code>Ignore</code></dt>
657 <dd>Treat bad header lines as if they weren't sent.</dd>
659 <dt><code>StartBody</code></dt>
660 <dd>When receiving the first bad header line, finish reading the headers and
661 treat the remainder as body. This helps to work around buggy backend servers
662 which forget to insert an empty line between the headers and the body.</dd>
666 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
667 <div class="directive-section"><h2><a name="ProxyBlock" id="ProxyBlock">ProxyBlock</a> <a name="proxyblock" id="proxyblock">Directive</a></h2>
668 <table class="directive">
669 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Words, hosts, or domains that are banned from being
671 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyBlock *|<var>word</var>|<var>host</var>|<var>domain</var>
672 [<var>word</var>|<var>host</var>|<var>domain</var>] ...</code></td></tr>
673 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
674 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
675 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
677 <p>The <code class="directive">ProxyBlock</code> directive specifies a list of
678 words, hosts and/or domains, separated by spaces. HTTP, HTTPS, and
679 FTP document requests to sites whose names contain matched words,
680 hosts or domains are <em>blocked</em> by the proxy server. The proxy
681 module will also attempt to determine IP addresses of list items which
682 may be hostnames during startup, and cache them for match test as
683 well. That may slow down the startup time of the server.</p>
685 <div class="example"><h3>Example</h3><p><code>
686 ProxyBlock joes-garage.com some-host.co.uk rocky.wotsamattau.edu
689 <p><code>rocky.wotsamattau.edu</code> would also be matched if referenced by
692 <p>Note that <code>wotsamattau</code> would also be sufficient to match
693 <code>wotsamattau.edu</code>.</p>
695 <p>Note also that</p>
697 <div class="example"><p><code>
701 <p>blocks connections to all sites.</p>
704 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
705 <div class="directive-section"><h2><a name="ProxyDomain" id="ProxyDomain">ProxyDomain</a> <a name="proxydomain" id="proxydomain">Directive</a></h2>
706 <table class="directive">
707 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Default domain name for proxied requests</td></tr>
708 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyDomain <var>Domain</var></code></td></tr>
709 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
710 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
711 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
713 <p>This directive is only useful for Apache httpd proxy servers within
714 intranets. The <code class="directive">ProxyDomain</code> directive specifies
715 the default domain which the apache proxy server will belong to. If a
716 request to a host without a domain name is encountered, a redirection
717 response to the same host with the configured <var>Domain</var> appended
718 will be generated.</p>
720 <div class="example"><h3>Example</h3><p><code>
721 ProxyRemote * http://firewall.example.com:81<br />
722 NoProxy .example.com 192.168.112.0/21<br />
723 ProxyDomain .example.com
727 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
728 <div class="directive-section"><h2><a name="ProxyErrorOverride" id="ProxyErrorOverride">ProxyErrorOverride</a> <a name="proxyerroroverride" id="proxyerroroverride">Directive</a></h2>
729 <table class="directive">
730 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Override error pages for proxied content</td></tr>
731 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyErrorOverride On|Off</code></td></tr>
732 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyErrorOverride Off</code></td></tr>
733 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
734 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
735 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
736 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.0 and later</td></tr>
738 <p>This directive is useful for reverse-proxy setups, where you want to
739 have a common look and feel on the error pages seen by the end user.
740 This also allows for included files (via
741 <code class="module"><a href="../mod/mod_include.html">mod_include</a></code>'s SSI) to get
742 the error code and act accordingly (default behavior would display
743 the error page of the proxied server, turning this on shows the SSI
746 <p>This directive does not affect the processing of informational (1xx),
747 normal success (2xx), or redirect (3xx) responses.</p>
750 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
751 <div class="directive-section"><h2><a name="ProxyIOBufferSize" id="ProxyIOBufferSize">ProxyIOBufferSize</a> <a name="proxyiobuffersize" id="proxyiobuffersize">Directive</a></h2>
752 <table class="directive">
753 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determine size of internal data throughput buffer</td></tr>
754 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyIOBufferSize <var>bytes</var></code></td></tr>
755 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyIOBufferSize 8192</code></td></tr>
756 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
757 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
758 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
760 <p>The <code class="directive">ProxyIOBufferSize</code> directive adjusts the size
761 of the internal buffer, which is used as a scratchpad for the data between
762 input and output. The size must be at least <code>512</code>.</p>
764 <p>In almost every case there's no reason to change that value.</p>
765 <p>If used with AJP this directive sets the maximum AJP packet size in
766 bytes. If you change it from the default, you must also change the
767 <code>packetSize</code> attribute of your AJP connector on the
768 Tomcat side! The attribute <code>packetSize</code> is only available
769 in Tomcat <code>5.5.20+</code> and <code>6.0.2+</code></p>
770 <p>Normally it is not necessary to change the maximum packet size.
771 Problems with the default value have been reported when sending
772 certificates or certificate chains.</p>
776 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
777 <div class="directive-section"><h2><a name="ProxyMatch" id="ProxyMatch"><ProxyMatch></a> <a name="proxymatch" id="proxymatch">Directive</a></h2>
778 <table class="directive">
779 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Container for directives applied to regular-expression-matched
780 proxied resources</td></tr>
781 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code><ProxyMatch <var>regex</var>> ...</ProxyMatch></code></td></tr>
782 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
783 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
784 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
786 <p>The <code class="directive"><ProxyMatch></code> directive is
787 identical to the <code class="directive"><a href="#proxy"><Proxy></a></code> directive, except it matches URLs
788 using <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expressions</a>.</p>
792 <li><code class="directive"><a href="#proxy"><Proxy></a></code></li>
795 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
796 <div class="directive-section"><h2><a name="ProxyMaxForwards" id="ProxyMaxForwards">ProxyMaxForwards</a> <a name="proxymaxforwards" id="proxymaxforwards">Directive</a></h2>
797 <table class="directive">
798 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maximium number of proxies that a request can be forwarded
800 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyMaxForwards <var>number</var></code></td></tr>
801 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyMaxForwards -1</code></td></tr>
802 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
803 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
804 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
805 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.0 and later;
806 default behaviour changed in 2.2.7/2.3</td></tr>
808 <p>The <code class="directive">ProxyMaxForwards</code> directive specifies the
809 maximum number of proxies through which a request may pass, if there's no
810 <code>Max-Forwards</code> header supplied with the request. This may
811 be set to prevent infinite proxy loops, or a DoS attack.</p>
813 <div class="example"><h3>Example</h3><p><code>
817 <p>Note that setting <code class="directive">ProxyMaxForwards</code> is a
818 violation of the HTTP/1.1 protocol (RFC2616), which forbids a Proxy
819 setting <code>Max-Forwards</code> if the Client didn't set it.
820 Earlier Apache httpd versions would always set it. A negative
821 <code class="directive">ProxyMaxForwards</code> value, including the
822 default -1, gives you protocol-compliant behaviour, but may
823 leave you open to loops.</p>
826 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
827 <div class="directive-section"><h2><a name="ProxyPass" id="ProxyPass">ProxyPass</a> <a name="proxypass" id="proxypass">Directive</a></h2>
828 <table class="directive">
829 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Maps remote servers into the local server URL-space</td></tr>
830 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPass [<var>path</var>] !|<var>url</var> [<var>key=value</var>
831 <var>[key=value</var> ...]] [nocanon] [interpolate]</code></td></tr>
832 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
833 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
834 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
836 <p>This directive allows remote servers to be mapped into the
837 space of the local server; the local server does not act as a
838 proxy in the conventional sense, but appears to be a mirror of the
839 remote server. The local server is often called a <dfn>reverse
840 proxy</dfn> or <dfn>gateway</dfn>. The <var>path</var> is the name of
841 a local virtual path; <var>url</var> is a partial URL for the
842 remote server and cannot include a query string.</p>
844 <div class="warning">The <code class="directive"><a href="#proxyrequests">ProxyRequests</a></code> directive should
845 usually be set <strong>off</strong> when using
846 <code class="directive">ProxyPass</code>.</div>
848 <p>Suppose the local server has address <code>http://example.com/</code>;
851 <div class="example"><p><code>
852 <Location /mirror/foo/><br />
853 <span class="indent">
854 ProxyPass http://backend.example.com/<br />
856 </Location><br />
859 <p>will cause a local request for
860 <code>http://example.com/mirror/foo/bar</code> to be internally converted
861 into a proxy request to <code>http://backend.example.com/bar</code>.</p>
863 <p>The following alternative syntax is possible, however carries a
864 performance penalty when present in large numbers:</p>
866 <div class="example"><p><code>
867 ProxyPass /mirror/foo/ http://backend.example.com/
870 <div class="warning">
871 <p>If the first argument ends with a trailing <strong>/</strong>, the second
872 argument should also end with a trailing <strong>/</strong> and vice
873 versa. Otherwise the resulting requests to the backend may miss some
874 needed slashes and do not deliver the expected results.
878 <p>The <code>!</code> directive is useful in situations where you don't want
879 to reverse-proxy a subdirectory, <em>e.g.</em></p>
881 <div class="example"><p><code>
882 <Location /mirror/foo/><br />
883 <span class="indent">
884 ProxyPass http://backend.example.com/<br />
886 </Location><br />
887 <Location /mirror/foo/i><br />
888 <span class="indent">
891 </Location><br />
894 <div class="example"><p><code>
895 ProxyPass /mirror/foo/i !<br />
896 ProxyPass /mirror/foo http://backend.example.com
899 <p>will proxy all requests to <code>/mirror/foo</code> to
900 <code>backend.example.com</code> <em>except</em> requests made to
901 <code>/mirror/foo/i</code>.</p>
903 <div class="warning"><h3>Ordering ProxyPass Directives</h3>
904 <p>The configured <code class="directive"><a href="#proxypass">ProxyPass</a></code>
905 and <code class="directive"><a href="#proxypassmatch">ProxyPassMatch</a></code>
906 rules are checked in the order of configuration. The first rule that
907 matches wins. So usually you should sort conflicting
908 <code class="directive"><a href="#proxypass">ProxyPass</a></code> rules starting with the
909 longest URLs first. Otherwise later rules for longer URLS will be hidden
910 by any earlier rule which uses a leading substring of the URL. Note that
911 there is some relation with worker sharing. In contrast, only one
912 <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive can be placed
913 in a <code class="directive"><a href="../mod/core.html#location">Location</a></code> block, and the most
914 specific location will take precedence.</p>
916 <p>For the same reasons exclusions must come <em>before</em> the
917 general <code class="directive">ProxyPass</code> directives.</p>
921 <p>In Apache HTTP Server 2.1 and later, mod_proxy supports pooled
922 connections to a backend server. Connections created on demand
923 can be retained in a pool for future use. Limits on the pool size
924 and other settings can be coded on
925 the <code class="directive">ProxyPass</code> directive
926 using <code>key=value</code> parameters, described in the table
929 <p>By default, mod_proxy will allow and retain the maximum number of
930 connections that could be used simultaneously by that web server child
931 process. Use the <code>max</code> parameter to reduce the number from
932 the default. Use the <code>ttl</code> parameter to set an optional
933 time to live; connections which have been unused for at least
934 <code>ttl</code> seconds will be closed. <code>ttl</code> can be used
935 to avoid using a connection which is subject to closing because of the
936 backend server's keep-alive timeout.</p>
938 <p>The pool of connections is maintained per web server child
939 process, and <code>max</code> and other settings are not coordinated
940 among all child processes, except when only one child process is allowed
941 by configuration or MPM design.</p>
943 <div class="example"><h3>Example</h3><p><code>
944 ProxyPass /example http://backend.example.com max=20 ttl=120 retry=300
948 <tr><th>Parameter</th>
950 <th>Description</th></tr>
953 <td>Minimum number of connection pool entries, unrelated to the
954 actual number of connections. This only needs to be modified from the
955 default for special circumstances where heap memory associated with the
956 backend connections should be preallocated or retained.</td></tr>
959 <td>Maximum number of connections that will be allowed to the
960 backend server. The default for this limit is the number of threads
961 per process in the active MPM. In the Prefork MPM, this is always 1,
962 while with other MPMs it is controlled by the
963 <code class="directive">ThreadsPerChild</code> directive.</td></tr>
966 <td>Retained connection pool entries above this limit are freed
967 during certain operations if they have been unused for longer than
968 the time to live, controlled by the <code>ttl</code> parameter. If
969 the connection pool entry has an associated connection, it will be
970 closed. This only needs to be modified from the default for special
971 circumstances where connection pool entries and any associated
972 connections which have exceeded the time to live need to be freed or
973 closed more aggressively.</td></tr>
976 <td>If set this will be the maximum time to wait for a free
977 connection in the connection pool, in milliseconds. If there are no free
978 connections in the pool the Apache httpd will return <code>SERVER_BUSY</code>
979 status to the client.
981 <tr><td>connectiontimeout</td>
983 <td>Connect timeout in seconds.
984 The number of seconds Apache httpd waits for the creation of a connection to
985 the backend to complete. By adding a postfix of ms the timeout can be
986 also set in milliseconds.
988 <tr><td>disablereuse</td>
990 <td>This parameter should be used when you want to force mod_proxy
991 to immediately close a connection to the backend after being used, and
992 thus, disable its persistent connection and pool for that backend.
993 This helps in various situations where a firewall between Apache
995 the backend server (regardless of protocol) tends to silently
996 drop connections or when backends themselves may be under round-
997 robin DNS. To disable connection pooling reuse,
998 set this property value to <code>On</code>.
1000 <tr><td>flushpackets</td>
1002 <td>Determines whether the proxy module will auto-flush the output
1003 brigade after each "chunk" of data. 'off' means that it will flush
1004 only when needed, 'on' means after each chunk is sent and
1005 'auto' means poll/wait for a period of time and flush if
1006 no input has been received for 'flushwait' milliseconds.
1007 Currently this is in effect only for AJP.
1009 <tr><td>flushwait</td>
1011 <td>The time to wait for additional input, in milliseconds, before
1012 flushing the output brigade if 'flushpackets' is 'auto'.
1014 <tr><td>iobuffersize</td>
1016 <td>Adjusts the size of the internal scratchpad IO buffer. This allows you
1017 to override the <code class="directive">ProxyIOBufferSize</code> for a specific worker.
1018 This must be at least 512 or set to 0 for the system default of 8192.
1020 <tr><td>keepalive</td>
1022 <td><p>This parameter should be used when you have a firewall between your
1023 Apache httpd and the backend server, who tend to drop inactive connections.
1024 This flag will tell the Operating System to send <code>KEEP_ALIVE</code>
1025 messages on inactive connections and thus prevent the firewall to drop the connection.
1026 To enable keepalive set this property value to <code>On</code>. </p>
1027 <p>The frequency of initial and subsequent TCP keepalive probes
1028 depends on global OS settings, and may be as high as 2 hours. To be useful,
1029 the frequency configured in the OS must be smaller than the threshold used
1030 by the firewall.</p>
1034 <td>Sets the load balancer cluster set that the worker is a member
1035 of. The load balancer will try all members of a lower numbered
1036 lbset before trying higher numbered ones.
1040 <td>Ping property tells the webserver to "test" the connection to
1041 the backend before forwarding the request. For AJP, it causes
1042 <code class="module"><a href="../mod/mod_proxy_ajp.html">mod_proxy_ajp</a></code>to send a <code>CPING</code>
1043 request on the ajp13 connection (implemented on Tomcat 3.3.2+, 4.1.28+
1044 and 5.0.13+). For HTTP, it causes <code class="module"><a href="../mod/mod_proxy_http.html">mod_proxy_http</a></code>
1045 to send a <code>100-Continue</code> to the backend (only valid for
1046 HTTP/1.1 - for non HTTP/1.1 backends, this property has no
1047 effect). In both cases the parameter is the delay in seconds to wait
1049 This feature has been added to avoid problems with hung and
1051 This will increase the network traffic during the normal operation
1052 which could be an issue, but it will lower the
1053 traffic in case some of the cluster nodes are down or busy.
1054 By adding a postfix of ms the delay can be also set in
1057 <tr><td>receivebuffersize</td>
1059 <td>Adjusts the size of the explicit (TCP/IP) network buffer size for
1060 proxied connections. This allows you to override the
1061 <code class="directive">ProxyReceiveBufferSize</code> for a specific worker.
1062 This must be at least 512 or set to 0 for the system default.
1064 <tr><td>redirect</td>
1066 <td>Redirection Route of the worker. This value is usually
1067 set dynamically to enable safe removal of the node from
1068 the cluster. If set all requests without session id will be
1069 redirected to the BalancerMember that has route parametar
1070 equal as this value.
1074 <td>Connection pool worker retry timeout in seconds.
1075 If the connection pool worker to the backend server is in the error state,
1076 Apache httpd will not forward any requests to that server until the timeout
1077 expires. This enables to shut down the backend server for maintenance,
1078 and bring it back online later. A value of 0 means always retry workers
1079 in an error state with no timeout.
1083 <td>Route of the worker when used inside load balancer.
1084 The route is a value appended to session id.
1088 <td>Single letter value defining the initial status of
1089 this worker: 'D' is disabled, 'S' is stopped, 'I' is ignore-errors,
1090 'H' is hot-standby and 'E' is in an error state. Status
1091 can be set (which is the default) by prepending with '+' or
1092 cleared by prepending with '-'.
1093 Thus, a setting of 'S-E' sets this worker to Stopped and
1094 clears the in-error flag.
1096 <tr><td>timeout</td>
1097 <td><code class="directive"><a href="#proxytimeout">ProxyTimeout</a></code></td>
1098 <td>Connection timeout in seconds.
1099 The number of seconds Apache httpd waits for data sent by / to the backend.
1103 <td>Time to live for inactive connections and associated connection
1104 pool entries, in seconds. Those which are unused for at least
1105 <code>ttl</code> seconds will be destroyed.
1110 <p>If the Proxy directive scheme starts with the
1111 <code>balancer://</code> (eg: <code>balancer://cluster/</code>,
1112 any path information is ignored) then a virtual worker that does not really
1113 communicate with the backend server will be created. Instead it is responsible
1114 for the management of several "real" workers. In that case the special set of
1115 parameters can be add to this virtual worker. See <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code>
1116 for more information about how the balancer works.
1119 <tr><th>Parameter</th>
1121 <th>Description</th></tr>
1122 <tr><td>lbmethod</td>
1124 <td>Balancer load-balance method. Select the load-balancing scheduler
1125 method to use. Either <code>byrequests</code>, to perform weighted
1126 request counting, <code>bytraffic</code>, to perform weighted
1127 traffic byte count balancing, or <code>bybusyness</code>, to perform
1128 pending request balancing. Default is <code>byrequests</code>.
1130 <tr><td>maxattempts</td>
1131 <td>One less than the number of workers, or 1 with a single worker.</td>
1132 <td>Maximum number of failover attempts before giving up.
1134 <tr><td>nofailover</td>
1136 <td>If set to <code>On</code> the session will break if the worker is in
1137 error state or disabled. Set this value to On if backend servers do not
1138 support session replication.
1140 <tr><td>stickysession</td>
1142 <td>Balancer sticky session name. The value is usually set to something
1143 like <code>JSESSIONID</code> or <code>PHPSESSIONID</code>,
1144 and it depends on the backend application server that support sessions.
1145 If the backend application server uses different name for cookies
1146 and url encoded id (like servlet containers) use | to to separate them.
1147 The first part is for the cookie the second for the path.
1149 <tr><td>scolonpathdelim</td>
1151 <td>If set to <code>On</code> the semi-colon character ';' will be
1152 used as an additional sticky session path deliminator/separator. This
1153 is mainly used to emulate mod_jk's behavior when dealing with paths such
1154 as <code>JSESSIONID=6736bcf34;foo=aabfa</code>
1156 <tr><td>timeout</td>
1158 <td>Balancer timeout in seconds. If set this will be the maximum time
1159 to wait for a free worker. Default is not to wait.
1161 <tr><td>failonstatus</td>
1163 <td>A single or comma-separated list of HTTP status codes. If set this will
1164 force the worker into error state when the backend returns any status code
1165 in the list. Worker recovery behaves the same as other worker errors.
1169 <p>A sample balancer setup</p>
1170 <div class="example"><p><code>
1171 ProxyPass /special-area http://special.example.com smax=5 max=10<br />
1172 ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=On<br />
1173 <Proxy balancer://mycluster><br />
1174 <span class="indent">
1175 BalancerMember ajp://1.2.3.4:8009<br />
1176 BalancerMember ajp://1.2.3.5:8009 loadfactor=20<br />
1177 # Less powerful server, don't send as many requests there,<br />
1178 BalancerMember ajp://1.2.3.6:8009 loadfactor=5<br />
1183 <p>Setting up a hot-standby, that will only be used if no other
1184 members are available</p>
1185 <div class="example"><p><code>
1186 ProxyPass / balancer://hotcluster/ <br />
1187 <Proxy balancer://hotcluster><br />
1188 <span class="indent">
1189 BalancerMember ajp://1.2.3.4:8009 loadfactor=1<br />
1190 BalancerMember ajp://1.2.3.5:8009 loadfactor=2<br />
1191 # The below is the hot standby<br />
1192 BalancerMember ajp://1.2.3.6:8009 status=+H<br />
1193 ProxySet lbmethod=bytraffic
1198 <p>Normally, mod_proxy will canonicalise ProxyPassed URLs.
1199 But this may be incompatible with some backends, particularly those
1200 that make use of <var>PATH_INFO</var>. The optional <var>nocanon</var>
1201 keyword suppresses this, and passes the URL path "raw" to the
1202 backend. Note that may affect the security of your backend, as it
1203 removes the normal limited protection against URL-based attacks
1204 provided by the proxy.</p>
1206 <p>The optional <var>interpolate</var> keyword (available in
1207 httpd 2.2.9 and later), in combination with
1208 <code class="directive">ProxyPassInterpolateEnv</code> causes the ProxyPass
1209 to interpolate environment variables, using the syntax
1210 <var>${VARNAME}</var>. Note that many of the standard CGI-derived
1211 environment variables will not exist when this interpolation happens,
1212 so you may still have to resort to <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
1213 for complex rules.</p>
1215 <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
1216 directory is obtained from the <code class="directive"><a href="../mod/core.html#location"><Location></a></code>. The same will occur inside a
1217 <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code> section,
1218 however ProxyPass does not interpret the regexp as such, so it is necessary
1219 to use <code class="directive">ProxyPassMatch</code> in this situation instead.</p>
1221 <p>If you require a more flexible reverse-proxy configuration, see the
1222 <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> directive with the
1223 <code>[P]</code> flag.</p>
1226 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1227 <div class="directive-section"><h2><a name="ProxyPassInterpolateEnv" id="ProxyPassInterpolateEnv">ProxyPassInterpolateEnv</a> <a name="proxypassinterpolateenv" id="proxypassinterpolateenv">Directive</a></h2>
1228 <table class="directive">
1229 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable Environment Variable interpolation in Reverse Proxy configurations</td></tr>
1230 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassInterpolateEnv On|Off</code></td></tr>
1231 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyPassInterpolateEnv Off</code></td></tr>
1232 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1233 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1234 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1235 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in httpd 2.2.9 and later</td></tr>
1237 <p>This directive, together with the <var>interpolate</var> argument to
1238 <code class="directive">ProxyPass</code>, <code class="directive">ProxyPassReverse</code>,
1239 <code class="directive">ProxyPassReverseCookieDomain</code> and
1240 <code class="directive">ProxyPassReverseCookiePath</code>
1241 enables reverse proxies to be dynamically
1242 configured using environment variables, which may be set by
1243 another module such as <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>.
1244 It affects the <code class="directive">ProxyPass</code>,
1245 <code class="directive">ProxyPassReverse</code>,
1246 <code class="directive">ProxyPassReverseCookieDomain</code>, and
1247 <code class="directive">ProxyPassReverseCookiePath</code> directives,
1248 and causes them to substitute the value of an environment
1249 variable <code>varname</code> for the string <code>${varname}</code>
1250 in configuration directives.</p>
1251 <p>Keep this turned off (for server performance) unless you need it!</p>
1254 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1255 <div class="directive-section"><h2><a name="ProxyPassMatch" id="ProxyPassMatch">ProxyPassMatch</a> <a name="proxypassmatch" id="proxypassmatch">Directive</a></h2>
1256 <table class="directive">
1257 <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>
1258 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassMatch [<var>regex</var>] !|<var>url</var> [<var>key=value</var>
1259 <var>[key=value</var> ...]]</code></td></tr>
1260 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1261 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1262 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1264 <p>This directive is equivalent to <code class="directive"><a href="#proxypass">ProxyPass</a></code>,
1265 but makes use of regular expressions, instead of simple prefix matching. The
1266 supplied regular expression is matched against the <var>url</var>, and if it
1267 matches, the server will substitute any parenthesized matches into the given
1268 string and use it as a new <var>url</var>.</p>
1270 <p>Suppose the local server has address <code>http://example.com/</code>;
1273 <div class="example"><p><code>
1274 ProxyPassMatch ^(/.*\.gif)$ http://backend.example.com$1
1277 <p>will cause a local request for
1278 <code>http://example.com/foo/bar.gif</code> to be internally converted
1279 into a proxy request to <code>http://backend.example.com/foo/bar.gif</code>.</p>
1280 <div class="note"><h3>Note</h3>
1281 <p>The URL argument must be parsable as a URL <em>before</em> regexp
1282 substitutions (as well as after). This limits the matches you can use.
1283 For instance, if we had used</p>
1284 <div class="example"><p><code>
1285 ProxyPassMatch ^(/.*\.gif)$ http://backend.example.com:8000$1
1287 <p>in our previous example, it would fail with a syntax error
1288 at server startup. This is a bug (PR 46665 in the ASF bugzilla),
1289 and the workaround is to reformulate the match:</p>
1290 <div class="example"><p><code>
1291 ProxyPassMatch ^/(.*\.gif)$ http://backend.example.com:8000/$1
1294 <p>The <code>!</code> directive is useful in situations where you don't want
1295 to reverse-proxy a subdirectory.</p>
1297 <p>When used inside a <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code> section, the first argument is omitted and the
1298 regexp is obtained from the <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code>.</p>
1300 <p>If you require a more flexible reverse-proxy configuration, see the
1301 <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> directive with the
1302 <code>[P]</code> flag.</p>
1305 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1306 <div class="directive-section"><h2><a name="ProxyPassReverse" id="ProxyPassReverse">ProxyPassReverse</a> <a name="proxypassreverse" id="proxypassreverse">Directive</a></h2>
1307 <table class="directive">
1308 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Adjusts the URL in HTTP response headers sent from a reverse
1309 proxied server</td></tr>
1310 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassReverse [<var>path</var>] <var>url</var>
1311 [<var>interpolate</var>]</code></td></tr>
1312 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1313 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1314 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1316 <p>This directive lets Apache httpd adjust the URL in the <code>Location</code>,
1317 <code>Content-Location</code> and <code>URI</code> headers on HTTP
1318 redirect responses. This is essential when Apache httpd is used as a
1319 reverse proxy (or gateway) to avoid by-passing the reverse proxy
1320 because of HTTP redirects on the backend servers which stay behind
1321 the reverse proxy.</p>
1323 <p>Only the HTTP response headers specifically mentioned above
1324 will be rewritten. Apache httpd will not rewrite other response
1325 headers, nor will it rewrite URL references inside HTML pages.
1326 This means that if the proxied content contains absolute URL
1327 references, they will by-pass the proxy. A third-party module
1328 that will look inside the HTML and rewrite URL references is Nick
1329 Kew's <a href="http://apache.webthing.com/mod_proxy_html/">mod_proxy_html</a>.</p>
1331 <p><var>path</var> is the name of a local virtual path. <var>url</var> is a
1332 partial URL for the remote server - the same way they are used for the
1333 <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive.</p>
1335 <p>For example, suppose the local server has address
1336 <code>http://example.com/</code>; then</p>
1338 <div class="example"><p><code>
1339 ProxyPass /mirror/foo/ http://backend.example.com/<br />
1340 ProxyPassReverse /mirror/foo/ http://backend.example.com/<br />
1341 ProxyPassReverseCookieDomain backend.example.com public.example.com<br />
1342 ProxyPassReverseCookiePath / /mirror/foo/
1345 <p>will not only cause a local request for the
1346 <code>http://example.com/mirror/foo/bar</code> to be internally converted
1347 into a proxy request to <code>http://backend.example.com/bar</code>
1348 (the functionality <code>ProxyPass</code> provides here). It also takes care
1349 of redirects the server <code>backend.example.com</code> sends: when
1350 <code>http://backend.example.com/bar</code> is redirected by him to
1351 <code>http://backend.example.com/quux</code> Apache httpd adjusts this to
1352 <code>http://example.com/mirror/foo/quux</code> before forwarding the HTTP
1353 redirect response to the client. Note that the hostname used for
1354 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>
1356 <p>Note that this <code class="directive">ProxyPassReverse</code> directive can
1357 also be used in conjunction with the proxy pass-through feature
1358 (<code>RewriteRule ... [P]</code>) from <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>
1359 because it doesn't depend on a corresponding <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive.</p>
1361 <p>The optional <var>interpolate</var> keyword (available in
1362 httpd 2.2.9 and later), used together with
1363 <code class="directive">ProxyPassInterpolateEnv</code>, enables interpolation
1364 of environment variables specified using the format <var>${VARNAME}</var>.
1367 <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
1368 directory is obtained from the <code class="directive"><a href="../mod/core.html#location"><Location></a></code>. The same occurs inside a <code class="directive"><a href="../mod/core.html#locationmatch"><LocationMatch></a></code> section, but will probably not work as
1369 intended, as ProxyPassReverse will interpret the regexp literally as a
1370 path; if needed in this situation, specify the ProxyPassReverse outside
1371 the section, or in a separate <code class="directive"><a href="../mod/core.html#location"><Location></a></code> section.</p>
1374 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1375 <div class="directive-section"><h2><a name="ProxyPassReverseCookieDomain" id="ProxyPassReverseCookieDomain">ProxyPassReverseCookieDomain</a> <a name="proxypassreversecookiedomain" id="proxypassreversecookiedomain">Directive</a></h2>
1376 <table class="directive">
1377 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Adjusts the Domain string in Set-Cookie headers from a reverse-
1378 proxied server</td></tr>
1379 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassReverseCookieDomain <var>internal-domain</var>
1380 <var>public-domain</var> [<var>interpolate</var>]</code></td></tr>
1381 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1382 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1383 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1385 <p>Usage is basically similar to
1386 <code class="directive"><a href="#proxypassreverse">ProxyPassReverse</a></code>, but instead of
1387 rewriting headers that are a URL, this rewrites the <code>domain</code>
1388 string in <code>Set-Cookie</code> headers.</p>
1391 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1392 <div class="directive-section"><h2><a name="ProxyPassReverseCookiePath" id="ProxyPassReverseCookiePath">ProxyPassReverseCookiePath</a> <a name="proxypassreversecookiepath" id="proxypassreversecookiepath">Directive</a></h2>
1393 <table class="directive">
1394 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Adjusts the Path string in Set-Cookie headers from a reverse-
1395 proxied server</td></tr>
1396 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassReverseCookiePath <var>internal-path</var>
1397 <var>public-path</var> [<var>interpolate</var>]</code></td></tr>
1398 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1399 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1400 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1402 <p>Usage is basically similar to
1403 <code class="directive"><a href="#proxypassreverse">ProxyPassReverse</a></code>, but instead of
1404 rewriting headers that are a URL, this rewrites the <code>path</code>
1405 string in <code>Set-Cookie</code> headers.</p>
1408 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1409 <div class="directive-section"><h2><a name="ProxyPreserveHost" id="ProxyPreserveHost">ProxyPreserveHost</a> <a name="proxypreservehost" id="proxypreservehost">Directive</a></h2>
1410 <table class="directive">
1411 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Use incoming Host HTTP request header for proxy
1413 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPreserveHost On|Off</code></td></tr>
1414 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyPreserveHost Off</code></td></tr>
1415 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
1416 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1417 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1418 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.0.31 and later. Usable in directory
1419 context in 2.3.3 and later.</td></tr>
1421 <p>When enabled, this option will pass the Host: line from the incoming
1422 request to the proxied host, instead of the hostname specified in the
1423 <code class="directive">ProxyPass</code> line.</p>
1425 <p>This option should normally be turned <code>Off</code>. It is mostly
1426 useful in special configurations like proxied mass name-based virtual
1427 hosting, where the original Host header needs to be evaluated by the
1431 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1432 <div class="directive-section"><h2><a name="ProxyReceiveBufferSize" id="ProxyReceiveBufferSize">ProxyReceiveBufferSize</a> <a name="proxyreceivebuffersize" id="proxyreceivebuffersize">Directive</a></h2>
1433 <table class="directive">
1434 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Network buffer size for proxied HTTP and FTP
1435 connections</td></tr>
1436 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyReceiveBufferSize <var>bytes</var></code></td></tr>
1437 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyReceiveBufferSize 0</code></td></tr>
1438 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1439 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1440 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1442 <p>The <code class="directive">ProxyReceiveBufferSize</code> directive specifies an
1443 explicit (TCP/IP) network buffer size for proxied HTTP and FTP connections,
1444 for increased throughput. It has to be greater than <code>512</code> or set
1445 to <code>0</code> to indicate that the system's default buffer size should
1448 <div class="example"><h3>Example</h3><p><code>
1449 ProxyReceiveBufferSize 2048
1453 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1454 <div class="directive-section"><h2><a name="ProxyRemote" id="ProxyRemote">ProxyRemote</a> <a name="proxyremote" id="proxyremote">Directive</a></h2>
1455 <table class="directive">
1456 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Remote proxy used to handle certain requests</td></tr>
1457 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyRemote <var>match</var> <var>remote-server</var></code></td></tr>
1458 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1459 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1460 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1462 <p>This defines remote proxies to this proxy. <var>match</var> is either the
1463 name of a URL-scheme that the remote server supports, or a partial URL
1464 for which the remote server should be used, or <code>*</code> to indicate
1465 the server should be contacted for all requests. <var>remote-server</var> is
1466 a partial URL for the remote server. Syntax:</p>
1468 <div class="example"><p><code>
1469 <dfn>remote-server</dfn> =
1470 <var>scheme</var>://<var>hostname</var>[:<var>port</var>]
1473 <p><var>scheme</var> is effectively the protocol that should be used to
1474 communicate with the remote server; only <code>http</code> and <code>https</code>
1475 are supported by this module. When using <code>https</code>, the requests
1476 are forwarded through the remote proxy using the HTTP CONNECT method.</p>
1478 <div class="example"><h3>Example</h3><p><code>
1479 ProxyRemote http://goodguys.example.com/ http://mirrorguys.example.com:8000<br />
1480 ProxyRemote * http://cleverproxy.localdomain<br />
1481 ProxyRemote ftp http://ftpproxy.mydomain:8080
1484 <p>In the last example, the proxy will forward FTP requests, encapsulated
1485 as yet another HTTP proxy request, to another proxy which can handle
1488 <p>This option also supports reverse proxy configuration - a backend
1489 webserver can be embedded within a virtualhost URL space even if that
1490 server is hidden by another forward proxy.</p>
1493 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1494 <div class="directive-section"><h2><a name="ProxyRemoteMatch" id="ProxyRemoteMatch">ProxyRemoteMatch</a> <a name="proxyremotematch" id="proxyremotematch">Directive</a></h2>
1495 <table class="directive">
1496 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Remote proxy used to handle requests matched by regular
1497 expressions</td></tr>
1498 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyRemoteMatch <var>regex</var> <var>remote-server</var></code></td></tr>
1499 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1500 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1501 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1503 <p>The <code class="directive">ProxyRemoteMatch</code> is identical to the
1504 <code class="directive"><a href="#proxyremote">ProxyRemote</a></code> directive, except the
1505 first argument is a <a class="glossarylink" href="../glossary.html#regex" title="see glossary">regular expression</a>
1506 match against the requested URL.</p>
1509 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1510 <div class="directive-section"><h2><a name="ProxyRequests" id="ProxyRequests">ProxyRequests</a> <a name="proxyrequests" id="proxyrequests">Directive</a></h2>
1511 <table class="directive">
1512 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables forward (standard) proxy requests</td></tr>
1513 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyRequests On|Off</code></td></tr>
1514 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyRequests Off</code></td></tr>
1515 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1516 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1517 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1519 <p>This allows or prevents Apache httpd from functioning as a forward proxy
1520 server. (Setting ProxyRequests to <code>Off</code> does not disable use of
1521 the <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive.)</p>
1523 <p>In a typical reverse proxy or gateway configuration, this
1524 option should be set to
1525 <code>Off</code>.</p>
1527 <p>In order to get the functionality of proxying HTTP or FTP sites, you
1528 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>
1529 (or both) present in the server.</p>
1531 <div class="warning"><h3>Warning</h3>
1532 <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
1533 both to your network and to the Internet at large.</p>
1538 <li><a href="#forwardreverse">Forward and Reverse Proxies/Gateways</a></li>
1541 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1542 <div class="directive-section"><h2><a name="ProxySet" id="ProxySet">ProxySet</a> <a name="proxyset" id="proxyset">Directive</a></h2>
1543 <table class="directive">
1544 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Set various Proxy balancer or member parameters</td></tr>
1545 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxySet <var>url</var> <var>key=value [key=value ...]</var></code></td></tr>
1546 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>directory</td></tr>
1547 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1548 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1549 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>ProxySet is only available in Apache HTTP Server 2.2
1550 and later.</td></tr>
1552 <p>This directive is used as an alternate method of setting any of the
1553 parameters available to Proxy balancers and workers normally done via the
1554 <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive. If used
1555 within a <code><Proxy <var>balancer url|worker url</var>></code>
1556 container directive, the <var>url</var> argument is not required. As a side
1557 effect the respective balancer or worker gets created. This can be useful
1558 when doing reverse proxying via a
1559 <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> instead of a
1560 <code class="directive"><a href="#proxypass">ProxyPass</a></code> directive.</p>
1562 <div class="example"><p><code>
1563 <Proxy balancer://hotcluster><br />
1564 <span class="indent">
1565 BalancerMember http://www2.example.com:8080 loadfactor=1<br />
1566 BalancerMember http://www3.example.com:8080 loadfactor=2<br />
1567 ProxySet lbmethod=bytraffic<br />
1572 <div class="example"><p><code>
1573 <Proxy http://backend><br />
1574 <span class="indent">
1575 ProxySet keepalive=On<br />
1580 <div class="example"><p><code>
1581 ProxySet balancer://foo lbmethod=bytraffic timeout=15
1584 <div class="example"><p><code>
1585 ProxySet ajp://backend:7001 timeout=15
1588 <div class="warning"><h3>Warning</h3>
1589 <p>Keep in mind that the same parameter key can have a different meaning
1590 depending whether it is applied to a balancer or a worker as shown by the two
1591 examples above regarding timeout.</p>
1596 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1597 <div class="directive-section"><h2><a name="ProxyStatus" id="ProxyStatus">ProxyStatus</a> <a name="proxystatus" id="proxystatus">Directive</a></h2>
1598 <table class="directive">
1599 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Show Proxy LoadBalancer status in mod_status</td></tr>
1600 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyStatus Off|On|Full</code></td></tr>
1601 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyStatus Off</code></td></tr>
1602 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1603 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1604 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1605 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.2 and later</td></tr>
1607 <p>This directive determines whether or not proxy
1608 loadbalancer status data is displayed via the <code class="module"><a href="../mod/mod_status.html">mod_status</a></code>
1609 server-status page.</p>
1610 <div class="note"><h3>Note</h3>
1611 <p><strong>Full</strong> is synonymous with <strong>On</strong></p>
1616 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1617 <div class="directive-section"><h2><a name="ProxyTimeout" id="ProxyTimeout">ProxyTimeout</a> <a name="proxytimeout" id="proxytimeout">Directive</a></h2>
1618 <table class="directive">
1619 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Network timeout for proxied requests</td></tr>
1620 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyTimeout <var>seconds</var></code></td></tr>
1621 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>Value of <code class="directive"><a href="../mod/core.html#timeout">Timeout</a></code></code></td></tr>
1622 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1623 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1624 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1625 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in Apache HTTP Server 2.0.31 and later</td></tr>
1627 <p>This directive allows a user to specifiy a timeout on proxy requests.
1628 This is useful when you have a slow/buggy appserver which hangs, and you
1629 would rather just return a timeout and fail gracefully instead of waiting
1630 however long it takes the server to return.</p>
1633 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
1634 <div class="directive-section"><h2><a name="ProxyVia" id="ProxyVia">ProxyVia</a> <a name="proxyvia" id="proxyvia">Directive</a></h2>
1635 <table class="directive">
1636 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Information provided in the <code>Via</code> HTTP response
1637 header for proxied requests</td></tr>
1638 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyVia On|Off|Full|Block</code></td></tr>
1639 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyVia Off</code></td></tr>
1640 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host</td></tr>
1641 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
1642 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr>
1644 <p>This directive controls the use of the <code>Via:</code> HTTP
1645 header by the proxy. Its intended use is to control the flow of
1646 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
1647 14.45 for an explanation of <code>Via:</code> header lines.</p>
1650 <li>If set to <code>Off</code>, which is the default, no special processing
1651 is performed. If a request or reply contains a <code>Via:</code> header,
1652 it is passed through unchanged.</li>
1654 <li>If set to <code>On</code>, each request and reply will get a
1655 <code>Via:</code> header line added for the current host.</li>
1657 <li>If set to <code>Full</code>, each generated <code>Via:</code> header
1658 line will additionally have the Apache httpd server version shown as a
1659 <code>Via:</code> comment field.</li>
1661 <li>If set to <code>Block</code>, every proxy request will have all its
1662 <code>Via:</code> header lines removed. No new <code>Via:</code> header will
1668 <div class="bottomlang">
1669 <p><span>Available Languages: </span><a href="../en/mod/mod_proxy.html" title="English"> en </a> |
1670 <a href="../fr/mod/mod_proxy.html" hreflang="fr" rel="alternate" title="Français"> fr </a> |
1671 <a href="../ja/mod/mod_proxy.html" hreflang="ja" rel="alternate" title="Japanese"> ja </a></p>
1672 </div><div id="footer">
1673 <p class="apache">Copyright 2010 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>
1674 <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>