Received: (from majordom@localhost) by hyperreal.com (8.8.4/8.8.4) id DAA29147; Fri, 18 Apr 1997 03:00:15 -0700 (PDT) Received: from thoth.mch.sni.de (thoth.mch.sni.de [192.35.17.2]) by hyperreal.com (8.8.4/8.8.4) with ESMTP id DAA29135 for ; Fri, 18 Apr 1997 03:00:10 -0700 (PDT) Received: from deejai.mch.sni.de (deejai.mch.sni.de [139.25.113.10]) by thoth.mch.sni.de (8.8.5/8.8.5) with ESMTP id MAA11237 for ; Fri, 18 Apr 1997 12:00:05 +0200 (MDT) Received: (from martin@localhost) by deejai.mch.sni.de (8.8.5/8.8.5) id MAA03171; Fri, 18 Apr 1997 12:00:03 +0200 (MET DST) From: Martin Kraemer Message-Id: <199704181000.MAA03171@deejai.mch.sni.de> Subject: [TIP]: How to use an Apache Proxy to filter Advertisements To: new-httpd@apache.org (Apache Mailing List), sni.intranet.usenet@deejai.mch.sni.de Date: Fri, 18 Apr 1997 12:00:01 +0200 (MET DST) X-Face: %0^)uynSVIl4|'Kt4&K^"0e)QSD,RsmBJzgofk.'s$\bu*4XXru?d/!|;"x{U(7#3z+wm^siToy]g3L'd1j`@kGb^4*CzYI-(.)ldeS8,G,X?Nko X-Operating-System: SINIX-D 5.41 C1001 X-Organization: Siemens-Nixdorf Informationssysteme AG (Muenchen, W.Germany) X-Phone: +49-89-636-46021 X-Fax: +49-89-636-44994 X-Disclaimer: THE COMMENTS CONTAINED IN THIS MESSAGE REFLECT THE VIEWS OF THE WRITER AND ARE NOT NECESSARILY THE VIEWS OF SIEMENS NIXDORF AG X-No-Junk-Mail: I do not want to get *any* junk mail. X-Mailer: ELM [version 2.4ME+ PL19 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org Hi, Here's a short note about a "feature" which can easily be realized using one of the latest apaches: the optional filtering of unwanted ads/commercials/promotions/sponsor banners etc. In place of the requested advertisement gif, a small "NoAds.gif" image is delivered (which is available locally on the server). On our proxy server, we offer a second port which delivers the filtered services, while the primary port works transparently: Port 80 # Primary server Port 80 Listen 80 # Anti-SPAM Port 81 Listen 81 We configure our server as proxy and enable the rewriting module (needs mod_rewrite and mod_proxy defined in Configuration, and mod_proxy must be defined _prior_to_ the definition of mod_rewrite!!!): ProxyRequests On ProxyRemote * http://firewall.to.inter.net This virtual host on the second port is now configured to filter ads. A directive is used for this purpose, in order not to disturb services on the primary port. The rules can be explained as follows: 1) When the browser sent a "Pragma: No-Cache" header (Reload pressed), proceed normally and serve the request. Otherwise: 2) if the request contains a subdirectory called /sponsor/, /ads/, / promotion/ and the like, (or /werbung/ for a german server), then: 3) serve the NoAds.gif instead. The rules could of course be refined to check whether the request really tried to load a *.jpeg, *.gif or *.png graphics file. But the result is already astonishingly successful. ServerAdmin WebMaster+81@myproxy.mch.sni.de ServerName myproxy.mch.sni.de ##### Anti-SPAM on port 81. Filter out typical commercials, unless [Reload] pressed RewriteEngine On #RewriteLog logs/rewrite_log #RewriteLogLevel 2 RewriteCond %{HTTP:Pragma} !^no-cache [NC] RewriteCond %{REQUEST_URI} ^http://[^/]*.*/[Pp]romotions/ [OR] RewriteCond %{REQUEST_URI} ^http://[^/]*.*/[Aa]d[vs]/ [OR] RewriteCond %{REQUEST_URI} ^http://[^/]*.*/[Ss]ponsors*/ [OR] RewriteCond %{REQUEST_URI} ^http://[a-zA-Z0-9.]*.de/[Ww]erbung/ RewriteRule ^.*$ /var/WWW/Web/images/NoAds.gif Cheers, Martin