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