Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 29413 invoked from network); 11 Mar 2007 23:26:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Mar 2007 23:26:17 -0000 Received: (qmail 78996 invoked by uid 500); 11 Mar 2007 23:26:16 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 78978 invoked by uid 500); 11 Mar 2007 23:26:16 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 78967 invoked by uid 99); 11 Mar 2007 23:26:16 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Mar 2007 16:26:16 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of matt.farey@gmail.com designates 66.249.92.172 as permitted sender) Received: from [66.249.92.172] (HELO ug-out-1314.google.com) (66.249.92.172) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Mar 2007 15:26:03 -0800 Received: by ug-out-1314.google.com with SMTP id 75so2041403ugb for ; Sun, 11 Mar 2007 16:25:42 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:x-enigmail-version:content-type:content-transfer-encoding; b=eWeZoVpTF0nIaO06JOhz5QT7YoB9FkOLOZFDGLPkLrhotJ06awJpi28nRTqzo/nJROhDEo9y27BFonj30QI3bFGGnR5PpX0y1CvmEy3+lJ7+oDnamge04h5G9GedxAtWzyjqEKANVLV8FaA5bKnJqIveO+lW5JdWTI89P2MdrxU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:subject:references:in-reply-to:x-enigmail-version:content-type:content-transfer-encoding; b=fiizRyAzBILm5TSpg6/6WBKNSYRzeRtIQBMlCNOuBlSuHt5kY3q68YtTniPn67cx3pxDa4thPsUr8fl297Gp/T7GyEWVfaJGp1g+bnHemYOJR6wUJlVWxWuui985TyX13RqAjO68xVf12BWTsk8gIo3B7t9Su6Tz8IS3rkousjQ= Received: by 10.67.93.6 with SMTP id v6mr15945903ugl.1173655542404; Sun, 11 Mar 2007 16:25:42 -0700 (PDT) Received: from ?192.168.0.5? ( [82.69.105.150]) by mx.google.com with ESMTP id 29sm5967679uga.2007.03.11.16.25.41; Sun, 11 Mar 2007 16:25:41 -0700 (PDT) Message-ID: <45F48FE7.8090709@gmail.com> Date: Sun, 11 Mar 2007 23:25:00 +0000 From: matt farey User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: users@httpd.apache.org References: <49bf44f10703091738v27ba449bse6ff5efcffa76f76@mail.gmail.com> <20070310095408.38117bf6@grimnir> <49bf44f10703111145jc1c7977t4850fff0d5c78b00@mail.gmail.com> <20070311185852.60ca7c6c@grimnir> <45F45829.1090902@gmail.com> <49bf44f10703111530x2ab13823hb8f4292e5d1646e5@mail.gmail.com> In-Reply-To: <49bf44f10703111530x2ab13823hb8f4292e5d1646e5@mail.gmail.com> X-Enigmail-Version: 0.94.2.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Subject: Re: [users@httpd] Stripping white space from HTML Grant wrote: >> As I understand it, the reason why you wish the whitespace to be reduced >> is so you look at the source within your browser, and that you plan to >> use mod_deflate later ro reduce bandwidth (which is surely not too much >> of a problem - it's probably equivalent to resampling a few of your >> images by 5% here and there, or optimising your caching!), but you can't >> reduce the whitespace inside your application logic (which is where the >> problem should be fixed) because you don't have control over the code. >> >> You have 3 (1,2,4) really good (performance neutral) options not >> mentioned so far, >> 1) use a whitespace stripping http proxy you run on your LAN >> 2) use mod security, removewhitespace in response body >> 3) use a rewrite rule to a reg exp based whitespace server-side script >> which serves each page of your application. >> 4) similar to (3) use an autoprepend rule to serve your white space >> laden pages through a reg exp based whitespace stripping script. >> >> I would probably go for 1,3 or 4, because they are so easy. >> >> (2) carries a performance hit, but use of mod security is highly >> regarded and I would say is an esssential part of protecting an >> application such as yours - one for which you do not own and cannot >> change the code. > > Thanks Matt. 3 and 4 sound interesting. How could I configure > something like that considering my block: > > > SetHandler perl-script > PerlResponseHandler Interchange::Link > PerlOptions +GlobalRequest > PerlSetVar InterchangeServer /path/to/socket > > > mod_security also sounds interesting. It's pretty tricky to set up > though? > > - Grant > > --------------------------------------------------------------------- > The official User-To-User support forum of the Apache HTTP Server > Project. > See for more info. > To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org > " from the digest: users-digest-unsubscribe@httpd.apache.org > For additional commands, e-mail: users-help@httpd.apache.org > > I didnt get whether you are using apache > 2.0.46 if so have you tried: | AddOutputFilter DEFLATE pl as to (3) | Perl isn't my first language, but I can show you using php. First setting up a rewrite (assuming you can use the rewrite engine on your apache server) to point any scripts which have the whitespace trouble to another script ReWriteEngine On ReWriteCond %{REMOTE_ADDR} ^some ip addresses$ReWriteRule ReWriteCond %{REQUEST_URI} ^(/?path/to/offending/scripts/[^/]*)$ ReWriteRule .* /white_space_remover.php?path=%1 [QSA, L] this rule rewrites all the requests to a script you identify as a problem - you could rewrite all requests but the chances are its one part of your app that's offending, so modify the path accordingly. The rewriterule also only occurs if its your IP. comment it out if you dont care whether your users see the whitespace. The path in the browser will stay at the original offending script URL, but the white_space_remover.pl will take the request url as a variable with the Query string (if any) and use that data to get the data from the users request that it will parse before sending to the user. The same thing can be acheived using the autoappend directive in php, if you have mod_php on your server. Instead of a rewrite you would use php_value autoprepend whie_space_remover.php the script would buffers the markup into a variable and use a quick reg exp to parse through it to remove the blank lines and whitespace, and then (optionally gzips it and) outputs it to the client user-agent. I am sure you can see how to modify the script to now gzip the data since of course make more sense to use mod_deflate in apache. But the white space stripping will work, and it all depends on your rewrite routing the request to this script, which then uses the value of the original requested uri, along with the query string to serve the request. OR, using method (1) you could install fiddler on a windows box somewhere and write a custom handler in C# which would strip whitespace from the response_body, and your browser could be set up to (foxyproxy) proxy the request via the windows box to see the whitespace-less version. Hope all that rough and unready and untested code helps! -- Matthew Farey --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See for more info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org " from the digest: users-digest-unsubscribe@httpd.apache.org For additional commands, e-mail: users-help@httpd.apache.org