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