variable <code>rate-limit</code>.</p>
<example><title>Example Configuration</title>
-<Location /downloads><br />
-<indent>
-SetOutputFilter RATE_LIMIT<br />
-SetEnv rate-limit 400 <br />
-</indent>
+<highlight language="config">
+<Location /downloads>
+ SetOutputFilter RATE_LIMIT
+ SetEnv rate-limit 400
</Location>
+</highlight>
</example>
</summary>
<dd>Pass the request body through the DEFLATE filter to compress the
body. This request requires a Content-Encoding request header containing
"gzip" for the filter to return compressed data.
- <example>
- <Location /compress><br/>
- SetHandler reflector<br/>
- SetOutputFilter DEFLATE<br/>
- </Location>
- </example>
+ <highlight language="config">
+<Location /compress>
+ SetHandler reflector
+ SetOutputFilter DEFLATE
+</Location>
+ </highlight>
</dd>
<dt>Image downsampling service</dt>
<dd>Pass the request body through an image downsampling filter, and reflect
the results to the caller.
- <example>
- <Location /downsample><br/>
- SetHandler reflector<br/>
- SetOutputFilter DOWNSAMPLE<br/>
- </Location>
- </example>
+ <highlight language="config">
+<Location /downsample>
+ SetHandler reflector
+ SetOutputFilter DOWNSAMPLE
+</Location>
+ </highlight>
</dd>
</dl>
</section>
hosts presenting a <directive>RemoteIPHeader</directive> IP value.</p>
<example><title>Internal (Load Balancer) Example</title>
+ <highlight language="config">
RemoteIPHeader X-Client-IP
+ </highlight>
</example>
<example><title>Proxy Example</title>
+ <highlight language="config">
RemoteIPHeader X-Forwarded-For
+ </highlight>
</example>
</usage>
</directivesynopsis>
trusted when passed from these proxies.</p>
<example><title>Internal (Load Balancer) Example</title>
- RemoteIPHeader X-Client-IP<br/>
- RemoteIPTrustedProxy 10.0.2.0/24<br/>
- RemoteIPTrustedProxy gateway.localdomain
+ <highlight language="config">
+RemoteIPHeader X-Client-IP
+RemoteIPTrustedProxy 10.0.2.0/24
+RemoteIPTrustedProxy gateway.localdomain
+ </highlight>
</example>
</usage>
</directivesynopsis>
</example>
<example><title>conf/trusted-proxies.lst contents</title>
- # Our internally trusted proxies;<br/>
- 10.0.2.0/24 #Everyone in the testing group<br/>
- gateway.localdomain #The front end balancer
+ <example><pre>
+# Our internally trusted proxies;
+10.0.2.0/24 #Everyone in the testing group
+gateway.localdomain #The front end balancer
+ </pre></example>
</example>
</usage>
</directivesynopsis>
<directive>RemoteIPInternalProxy</directive> addresses are discarded.</p>
<example><title>Example</title>
- RemoteIPHeader X-Forwarded-For<br/>
- RemoteIPProxiesHeader X-Forwarded-By
+ <highlight language="config">
+RemoteIPHeader X-Forwarded-For
+RemoteIPProxiesHeader X-Forwarded-By
+ </highlight>
</example>
</usage>
</directivesynopsis>
<directive>RemoteIPHeader</directive> header's value.</p>
<example><title>Trusted (Load Balancer) Example</title>
- RemoteIPHeader X-Forwarded-For<br/>
- RemoteIPTrustedProxy 10.0.2.16/28<br/>
- RemoteIPTrustedProxy proxy.example.com
+ <highlight language="config">
+RemoteIPHeader X-Forwarded-For
+RemoteIPTrustedProxy 10.0.2.16/28
+RemoteIPTrustedProxy proxy.example.com
+ </highlight>
</example>
</usage>
</directivesynopsis>
the <directive>RemoteIPTrustedProxy</directive> directive.</p>
<example><title>Trusted (Load Balancer) Example</title>
- RemoteIPHeader X-Forwarded-For<br/>
- RemoteIPTrustedProxyList conf/trusted-proxies.lst
+ <highlight language="config">
+RemoteIPHeader X-Forwarded-For
+RemoteIPTrustedProxyList conf/trusted-proxies.lst
+ </highlight>
</example>
<example><title>conf/trusted-proxies.lst contents</title>
Allow 10 seconds to receive the request including the headers and
30 seconds for receiving the request body:
- <example>
+ <highlight language="config">
RequestReadTimeout header=10 body=30
- </example>
+ </highlight>
</li>
<li>
the limit given indirectly by
<directive module="core">LimitRequestBody</directive>):
- <example>
+ <highlight language="config">
RequestReadTimeout body=10,MinRate=1000
- </example>
+ </highlight>
</li>
<li>
500 bytes received. But do not allow more than 30 seconds for the
request including the headers:
- <example>
+ <highlight language="config">
RequestReadTimeout header=10-30,MinRate=500
- </example>
+ </highlight>
</li>
<li>
If a common configuration is used for http and https virtual hosts, the
timeouts should not be set too low:
- <example>
+ <highlight language="config">
RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500
- </example>
+ </highlight>
</li>
</ol>
</note>
<example><title>Example</title>
+ <highlight language="config">
LogLevel alert rewrite:trace3
+ </highlight>
</example>
<note><title>RewriteLog</title>
<p>For example, you might define a
<directive>RewriteMap</directive> as:</p>
- <example>
+ <highlight language="config">
RewriteMap examplemap txt:/path/to/file/map.txt
- </example>
+ </highlight>
<p>You would then be able to use this map in a
<directive>RewriteRule</directive> as follows:</p>
- <example>
+ <highlight language="config">
RewriteRule ^/ex/(.*) ${examplemap:$1}
- </example>
+ </highlight>
<p>The following combinations for <em>MapType</em> and
<em>MapSource</em> can be used:</p>
since the resource was not relative to the document root. This
misconfiguration would normally cause the server to look for an "opt"
directory under the document root.</p>
-<example>
-<pre>
+<highlight language="config">
DocumentRoot /var/www/example.com
Alias /myapp /opt/myapp-1.2.3
<Directory /opt/myapp-1.2.3>
-RewriteEngine On
-RewriteBase /myapp/
-RewriteRule ^index\.html$ welcome.html
+ RewriteEngine On
+ RewriteBase /myapp/
+ RewriteRule ^index\.html$ welcome.html
</Directory>
-</pre>
-</example>
+</highlight>
</usage>
</directivesynopsis>
to block unwanted hotlinking.
</p>
- <example>
+ <highlight language="config">
RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/*'"<br />
RewriteRule ^/images - [F]
- </example>
+ </highlight>
</li>
<li>You can also set special flags for
Use this to combine rule conditions with a local OR
instead of the implicit AND. Typical example:
-<example>
-<pre>
+<highlight language="config">
RewriteCond %{REMOTE_HOST} ^host1 [OR]
RewriteCond %{REMOTE_HOST} ^host2 [OR]
RewriteCond %{REMOTE_HOST} ^host3
RewriteRule ...some special stuff for any of these hosts...
-</pre>
-</example>
+</highlight>
Without this flag you would have to write the condition/rule
pair three times.
``<code>User-Agent:</code>'' header of the request, you can
use the following: </p>
-<example>
-<pre>
+<highlight language="config">
RewriteCond %{HTTP_USER_AGENT} ^Mozilla
RewriteRule ^/$ /homepage.max.html [L]
RewriteRule ^/$ /homepage.min.html [L]
RewriteRule ^/$ /homepage.std.html [L]
-</pre>
-</example>
+</highlight>
<p>Explanation: If you use a browser which identifies itself
as 'Mozilla' (including Netscape Navigator, Mozilla etc), then you