
rbowen at apache
Nov 4, 2009, 4:43 PM
Post #1 of 1
(51 views)
Permalink
|
|
svn commit: r832935 - in /httpd/httpd/trunk/docs/manual/rewrite: access.html.en access.xml rewrite_guide.html.en rewrite_guide.xml
|
|
Author: rbowen Date: Thu Nov 5 00:43:08 2009 New Revision: 832935 URL: http://svn.apache.org/viewvc?rev=832935&view=rev Log: Relocates another rule. Please also note that this rule refers to before and after 1.3b6. That's embarrassing. It would be great if someone would apply the relevant changes to the 2.2 and 2.0 docs also. Modified: httpd/httpd/trunk/docs/manual/rewrite/access.html.en httpd/httpd/trunk/docs/manual/rewrite/access.xml httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml Modified: httpd/httpd/trunk/docs/manual/rewrite/access.html.en URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/access.html.en?rev=832935&r1=832934&r2=832935&view=diff ============================================================================== --- httpd/httpd/trunk/docs/manual/rewrite/access.html.en (original) +++ httpd/httpd/trunk/docs/manual/rewrite/access.html.en Thu Nov 5 00:43:08 2009 @@ -37,6 +37,7 @@ </div> <div id="quickview"><ul id="toc"><li><img alt="" src="../images/down.gif" /> <a href="#blocked-inline-images">Forbidding Image "Hotlinking"</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#blocking-of-robots">Blocking of Robots</a></li> +<li><img alt="" src="../images/down.gif" /> <a href="#host-deny">Denying Hosts in a Blacklist</a></li> </ul><h3>See also</h3><ul class="seealso"><li><a href="../mod/mod_rewrite.html">Module documentation</a></li><li><a href="intro.html">mod_rewrite introduction</a></li></ul></div> <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> @@ -191,7 +192,59 @@ </dl> - </div></div> + </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> +<div class="section"> +<h2><a name="host-deny" id="host-deny">Denying Hosts in a Blacklist</a></h2> + + + + <dl> + <dt>Description:</dt> + + <dd> + <p>We wish to maintain a blacklist of hosts, rather like + <code>hosts.deny</code>, and have those hosts blocked from + accessing our server.</p> + </dd> + + <dt>Solution:</dt> + + <dd> +<div class="example"><pre> +RewriteEngine on +RewriteMap hosts-deny txt:/path/to/hosts.deny +RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND [OR] +RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND +RewriteRule ^ - [F] +</pre></div> + +<div class="example"><pre> +## +## hosts.deny +## +## ATTENTION! This is a map, not a list, even when we treat it as such. +## mod_rewrite parses it for key/value pairs, so at least a +## dummy value "-" must be present for each entry. +## + +193.102.180.41 - +bsdti1.sdm.de - +192.76.162.40 - +</pre></div> + </dd> + + <dt>Discussion:</dt> + <dd> + <p> + The second RewriteCond assumes that you have HostNameLookups turned + on, so that client IP addresses will be resolved. If that's not the + case, you should drop the second rule, and drop the + <code>[OR]</code> flag from the first RewriteCond. + </p> + </dd> + </dl> + +</div></div> <div class="bottomlang"> <p><span>Available Languages: </span><a href="../en/rewrite/access.html" title="English"> en </a></p> </div><div id="footer"> Modified: httpd/httpd/trunk/docs/manual/rewrite/access.xml URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/access.xml?rev=832935&r1=832934&r2=832935&view=diff ============================================================================== --- httpd/httpd/trunk/docs/manual/rewrite/access.xml (original) +++ httpd/httpd/trunk/docs/manual/rewrite/access.xml Thu Nov 5 00:43:08 2009 @@ -196,4 +196,56 @@ </section> +<section id="host-deny"> + + <title>Denying Hosts in a Blacklist</title> + + <dl> + <dt>Description:</dt> + + <dd> + <p>We wish to maintain a blacklist of hosts, rather like + <code>hosts.deny</code>, and have those hosts blocked from + accessing our server.</p> + </dd> + + <dt>Solution:</dt> + + <dd> +<example><pre> +RewriteEngine on +RewriteMap hosts-deny txt:/path/to/hosts.deny +RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND [OR] +RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND +RewriteRule ^ - [F] +</pre></example> + +<example><pre> +## +## hosts.deny +## +## ATTENTION! This is a map, not a list, even when we treat it as such. +## mod_rewrite parses it for key/value pairs, so at least a +## dummy value "-" must be present for each entry. +## + +193.102.180.41 - +bsdti1.sdm.de - +192.76.162.40 - +</pre></example> + </dd> + + <dt>Discussion:</dt> + <dd> + <p> + The second RewriteCond assumes that you have HostNameLookups turned + on, so that client IP addresses will be resolved. If that's not the + case, you should drop the second rule, and drop the + <code>[OR]</code> flag from the first RewriteCond. + </p> + </dd> + </dl> + +</section> + </manualpage> Modified: httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en?rev=832935&r1=832934&r2=832935&view=diff ============================================================================== --- httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en (original) +++ httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.html.en Thu Nov 5 00:43:08 2009 @@ -61,7 +61,6 @@ <li><img alt="" src="../images/down.gif" /> <a href="#on-the-fly-content">On-the-fly Content-Regeneration</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#autorefresh">Document With Autorefresh</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#mass-virtual-hosting">Mass Virtual Hosting</a></li> -<li><img alt="" src="../images/down.gif" /> <a href="#host-deny">Host Deny</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#proxy-deny">Proxy Deny</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#special-authentication">Special Authentication Variant</a></li> <li><img alt="" src="../images/down.gif" /> <a href="#referer-deflector">Referer-based Deflector</a></li> @@ -1210,61 +1209,6 @@ </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> <div class="section"> -<h2><a name="host-deny" id="host-deny">Host Deny</a></h2> - - - - <dl> - <dt>Description:</dt> - - <dd> - <p>How can we forbid a list of externally configured hosts - from using our server?</p> - </dd> - - <dt>Solution:</dt> - - <dd> - <p>For Apache >= 1.3b6:</p> - -<div class="example"><pre> -RewriteEngine on -RewriteMap hosts-deny txt:/path/to/hosts.deny -RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND [OR] -RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND -RewriteRule ^/.* - [F] -</pre></div> - - <p>For Apache <= 1.3b6:</p> - -<div class="example"><pre> -RewriteEngine on -RewriteMap hosts-deny txt:/path/to/hosts.deny -RewriteRule ^/(.*)$ ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}/$1 -RewriteRule !^NOT-FOUND/.* - [F] -RewriteRule ^NOT-FOUND/(.*)$ ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}/$1 -RewriteRule !^NOT-FOUND/.* - [F] -RewriteRule ^NOT-FOUND/(.*)$ /$1 -</pre></div> - -<div class="example"><pre> -## -## hosts.deny -## -## ATTENTION! This is a map, not a list, even when we treat it as such. -## mod_rewrite parses it for key/value pairs, so at least a -## dummy value "-" must be present for each entry. -## - -193.102.180.41 - -bsdti1.sdm.de - -192.76.162.40 - -</pre></div> - </dd> - </dl> - - </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div> -<div class="section"> <h2><a name="proxy-deny" id="proxy-deny">Proxy Deny</a></h2> Modified: httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml?rev=832935&r1=832934&r2=832935&view=diff ============================================================================== --- httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml (original) +++ httpd/httpd/trunk/docs/manual/rewrite/rewrite_guide.xml Thu Nov 5 00:43:08 2009 @@ -1201,61 +1201,6 @@ </section> - <section id="host-deny"> - - <title>Host Deny</title> - - <dl> - <dt>Description:</dt> - - <dd> - <p>How can we forbid a list of externally configured hosts - from using our server?</p> - </dd> - - <dt>Solution:</dt> - - <dd> - <p>For Apache >= 1.3b6:</p> - -<example><pre> -RewriteEngine on -RewriteMap hosts-deny txt:/path/to/hosts.deny -RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND [OR] -RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND -RewriteRule ^/.* - [F] -</pre></example> - - <p>For Apache <= 1.3b6:</p> - -<example><pre> -RewriteEngine on -RewriteMap hosts-deny txt:/path/to/hosts.deny -RewriteRule ^/(.*)$ ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND}/$1 -RewriteRule !^NOT-FOUND/.* - [F] -RewriteRule ^NOT-FOUND/(.*)$ ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND}/$1 -RewriteRule !^NOT-FOUND/.* - [F] -RewriteRule ^NOT-FOUND/(.*)$ /$1 -</pre></example> - -<example><pre> -## -## hosts.deny -## -## ATTENTION! This is a map, not a list, even when we treat it as such. -## mod_rewrite parses it for key/value pairs, so at least a -## dummy value "-" must be present for each entry. -## - -193.102.180.41 - -bsdti1.sdm.de - -192.76.162.40 - -</pre></example> - </dd> - </dl> - - </section> - <section id="proxy-deny"> <title>Proxy Deny</title>
|