📄 mod_proxy.html.en
字号:
</td></tr> <tr><td>retry</td> <td>60</td> <td>Connection pool worker retry timeout in seconds. If the connection pool worker to the backend server is in the error state, Apache will not forward any requests to that server until the timeout expires. This enables to shut down the backend server for maintenance, and bring it back online later. A value of 0 means always retry workers in an error state with no timeout. </td></tr> <tr><td>route</td> <td>-</td> <td>Route of the worker when used inside load balancer. The route is a value appended to session id. </td></tr> <tr><td>status</td> <td>-</td> <td>Single letter value defining the initial status of this worker: 'D' is disabled, 'S' is stopped, 'I' is ignore-errors, 'H' is hot-standby and 'E' is in an error state. Status can be set (which is the default) by prepending with '+' or cleared by prepending with '-'. Thus, a setting of 'S-E' sets this worker to Stopped and clears the in-error flag. </td></tr> <tr><td>timeout</td> <td><code class="directive"><a href="#proxytimeout">ProxyTimeout</a></code></td> <td>Connection timeout in seconds. The number of seconds Apache waits for data sent by / to the backend. </td></tr> <tr><td>ttl</td> <td>-</td> <td>Time To Live for the inactive connections above the <code>smax</code> connections in seconds. Apache will close all connections that has not been used inside that time period. </td></tr> </table> <p>If the Proxy directive scheme starts with the <code>balancer://</code> then a virtual worker that does not really communicate with the backend server will be created. Instead it is responsible for the management of several "real" workers. In that case the special set of parameters can be add to this virtual worker. See <code class="module"><a href="../mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code> for more information about how the balancer works. </p> <table> <tr><th>Parameter</th> <th>Default</th> <th>Description</th></tr> <tr><td>lbmethod</td> <td>byrequests</td> <td>Balancer load-balance method. Select the load-balancing scheduler method to use. Either <code>byrequests</code>, to perform weighted request counting, <code>bytraffic</code>, to perform weighted traffic byte count balancing, or <code>bybusyness</code>, to perform pending request balancing. Default is <code>byrequests</code>. </td></tr> <tr><td>maxattempts</td> <td>1</td> <td>Maximum number of failover attempts before giving up. </td></tr> <tr><td>nofailover</td> <td>Off</td> <td>If set to <code>On</code> the session will break if the worker is in error state or disabled. Set this value to On if backend servers do not support session replication. </td></tr> <tr><td>stickysession</td> <td>-</td> <td>Balancer sticky session name. The value is usually set to something like <code>JSESSIONID</code> or <code>PHPSESSIONID</code>, and it depends on the backend application server that support sessions. If the backend application server uses different name for cookies and url encoded id (like servlet containers) use | to to separate them. The first part is for the cookie the second for the path. </td></tr> <tr><td>scolonpathdelim</td> <td>Off</td> <td>If set to <code>On</code> the semi-colon character ';' will be used as an additional sticky session path deliminator/separator. This is mainly used to emulate mod_jk's behavior when dealing with paths such as <code>JSESSIONID=6736bcf34;foo=aabfa</code> </td></tr> <tr><td>timeout</td> <td>0</td> <td>Balancer timeout in seconds. If set this will be the maximum time to wait for a free worker. Default is not to wait. </td></tr> </table> <p>A sample balancer setup</p> <div class="example"><p><code> ProxyPass /special-area http://special.example.com/ smax=5 max=10<br /> ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=On<br /> <Proxy balancer://mycluster><br /> <span class="indent"> BalancerMember http://1.2.3.4:8009<br /> BalancerMember http://1.2.3.5:8009 smax=10<br /> # Less powerful server, don't send as many requests there<br /> BalancerMember http://1.2.3.6:8009 smax=1 loadfactor=20<br /> </span> </Proxy> </code></p></div> <p>Setting up a hot-standby, that will only be used if no other members are available</p> <div class="example"><p><code> ProxyPass / balancer://hotcluster/ <br /> <Proxy balancer://hotcluster><br /> <span class="indent"> BalancerMember http://1.2.3.4:8009 loadfactor=1<br /> BalancerMember http://1.2.3.5:8009 loadfactor=2<br /> # The below is the hot standby<br /> BalancerMember http://1.2.3.6:8009 status=+H<br /> ProxySet lbmethod=bytraffic </span> </Proxy> </code></p></div> <p>Normally, mod_proxy will canonicalise ProxyPassed URLs. But this may be incompatible with some backends, particularly those that make use of <var>PATH_INFO</var>. The optional <var>nocanon</var> keyword suppresses this, and passes the URL path "raw" to the backend. Note that may affect the security of your backend, as it removes the normal limited protection against URL-based attacks provided by the proxy.</p> <p>The optional <var>interpolate</var> keyword (available in httpd 2.2.9 and later), in combination with <code class="directive">ProxyPassInterpolateEnv</code> causes the ProxyPass to interpolate environment variables, using the syntax <var>${VARNAME}</var>. Note that many of the standard CGI-derived environment variables will not exist when this interpolation happens, so you may still have to resort to <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code> for complex rules.</p> <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 directory is obtained from the <code class="directive"><a href="../mod/core.html#location"><Location></a></code>.</p> <p>If you require a more flexible reverse-proxy configuration, see the <code class="directive"><a href="../mod/mod_rewrite.html#rewriterule">RewriteRule</a></code> directive with the <code>[P]</code> flag.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ProxyPassInterpolateEnv" id="ProxyPassInterpolateEnv">ProxyPassInterpolateEnv</a> <a name="proxypassinterpolateenv" id="proxypassinterpolateenv">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable Environment Variable interpolation in Reverse Proxy configurations</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassInterpolateEnv On|Off</code></td></tr><tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyPassInterpolateEnv Off</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Available in httpd 2.2.9 and later</td></tr></table> <p>This directive, together with the <var>interpolate</var> argument to <code class="directive">ProxyPass</code>, <code class="directive">ProxyPassReverse</code>, <code class="directive">ProxyPassReverseCookieDomain</code> and <code class="directive">ProxyPassReverseCookiePath</code> enables reverse proxies to be dynamically configured using environment variables, which may be set by another module such as <code class="module"><a href="../mod/mod_rewrite.html">mod_rewrite</a></code>. It affects the <code class="directive">ProxyPass</code>, <code class="directive">ProxyPassReverse</code>, <code class="directive">ProxyPassReverseCookieDomain</code>, and <code class="directive">ProxyPassReverseCookiePath</code> directives, and causes them to substitute the value of an environment variable <code>varname</code> for the string <code>${varname}</code> in configuration directives.</p> <p>Keep this turned off (for server performance) unless you need it!</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ProxyPassMatch" id="ProxyPassMatch">ProxyPassMatch</a> <a name="proxypassmatch" id="proxypassmatch">Directive</a></h2><table class="directive"><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><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassMatch [<var>regex</var>] !|<var>url</var> [<var>key=value</var> <var>[key=value</var> ...]]</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr><tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>available in Apache 2.2.5 and later</td></tr></table> <p>This directive is equivalent to <code class="directive"><a href="#proxypass">ProxyPass</a></code>, but makes use of regular expressions, instead of simple prefix matching. The supplied regular expression is matched against the <var>url</var>, and if it matches, the server will substitute any parenthesized matches into the given string and use it as a new <var>url</var>.</p> <p>Suppose the local server has address <code>http://example.com/</code>; then</p> <div class="example"><p><code> ProxyPassMatch ^(/.*\.gif)$ http://backend.example.com$1 </code></p></div> <p>will cause a local request for <code>http://example.com/foo/bar.gif</code> to be internally converted into a proxy request to <code>http://backend.example.com/foo/bar.gif</code>.</p> <p>The <code>!</code> directive is useful in situations where you don't want to reverse-proxy a subdirectory.</p></div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div><div class="directive-section"><h2><a name="ProxyPassReverse" id="ProxyPassReverse">ProxyPassReverse</a> <a name="proxypassreverse" id="proxypassreverse">Directive</a></h2><table class="directive"><tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Adjusts the URL in HTTP response headers sent from a reverseproxied server</td></tr><tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyPassReverse [<var>path</var>] <var>url</var>[<var>interpolate</var>]</code></td></tr><tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr><tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr><tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy</td></tr></table> <p>This directive lets Apache adjust the URL in the <code>Location</code>, <code>Content-Location</code> and <code>URI</code> headers on HTTP redirect responses. This is essential when Apache is used as a reverse proxy (or gateway) to avoid by-passing the reverse proxy because of HTTP redirects on the backend servers which stay behind the reverse proxy.</p> <p>Only the HTTP response headers specifically mentioned above will be rewritten. Apache will not rewrite other response headers, nor will it rewrite URL references inside HTML pages
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -