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