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