You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Karl Denninger <ka...@denninger.net> on 2007/08/28 03:10:11 UTC
[users@httpd] Question regarding mod_deflate and CGI output
Hi folks;
I am attempting to use mod_deflate to compress ONLY text output files
(since "compressing" images is a waste, natch)
I have the following in my httpd.conf file:
#
# Deflate text if the user's browser can handle it
#
AddOutputFilterByType DEFLATE text/html text/plain text/xml
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog /var/log/httpd.deflate_log deflate
Which, for static sites, works fine.
However, I have a site which is entirely built by a CGI program. That
program returns a proper "Content-Type:" header; some content is
text/html, some might be text/xml, some might be image/gif, some might
be image/jpeg, etc.
Well, it appears that Apache isn't actually looking at those headers,
and the deflate filter is "compressing" all output - including the stuff
that can't be compressed!
While this isn't a huge deal (it just doesn't get any smaller) it is
hitting my CPU pretty hard.
Here's an example from the deflate log file:
"GET /cgi-ticker/akcs-www HTTP/1.1" 6466/21060 (30%)
"GET /cgi-ticker/akcs-www?getavatar=foxymoron HTTP/1.1" 8459/8696 (97%)
"GET /smilies/money.gif HTTP/1.1" 207/202 (102%)
First line, good, second not so good (that's a JPEG file!) and the
third, NO NO NO NO!
How come, given that I specified the types I wanted to be "deflated" above?
--
Karl Denninger (karl@denninger.net)
http://www.denninger.net
%SPAMBLOCK-SYS: Matched [apache.org], message ok
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> 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
Re: [users@httpd] Question regarding mod_deflate and CGI output
Posted by Karl Denninger <ka...@denninger.net>.
Attempted that.... its not obvious how to get the correct syntax to
replace what I had there before.... (and is not in the examples)
Any hints?
Karl Denninger (karl@denninger.net)
http://www.denninger.net
Joshua Slive wrote:
> On 8/27/07, Karl Denninger <ka...@denninger.net> wrote:
>
>
>> However, I have a site which is entirely built by a CGI program. That
>> program returns a proper "Content-Type:" header; some content is
>> text/html, some might be text/xml, some might be image/gif, some might
>> be image/jpeg, etc.
>>
>
> AddOutputFilterByType doesn't work reliably under these circumstances.
> Use mod_filter instead:
> http://httpd.apache.org/docs/2.2/mod/mod_filter.html
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> 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
>
>
>
> %SPAMBLOCK-SYS: Matched [apache.org], message ok
>
Re: [users@httpd] Question regarding mod_deflate and CGI output
Posted by Karl Denninger <ka...@denninger.net>.
Joshua Slive wrote:
> On 8/27/07, Karl Denninger <ka...@denninger.net> wrote:
>
>
>> However, I have a site which is entirely built by a CGI program. That
>> program returns a proper "Content-Type:" header; some content is
>> text/html, some might be text/xml, some might be image/gif, some might
>> be image/jpeg, etc.
>>
>
> AddOutputFilterByType doesn't work reliably under these circumstances.
> Use mod_filter instead:
> http://httpd.apache.org/docs/2.2/mod/mod_filter.html
>
> Joshua.
>
>
Please disregard my last reply - I think I figured it out... it appears
to be doing the "right thing" now..... thanks!
-- Karl
Re: [users@httpd] Question regarding mod_deflate and CGI output
Posted by Joshua Slive <jo...@slive.ca>.
On 8/27/07, Karl Denninger <ka...@denninger.net> wrote:
> However, I have a site which is entirely built by a CGI program. That
> program returns a proper "Content-Type:" header; some content is
> text/html, some might be text/xml, some might be image/gif, some might
> be image/jpeg, etc.
AddOutputFilterByType doesn't work reliably under these circumstances.
Use mod_filter instead:
http://httpd.apache.org/docs/2.2/mod/mod_filter.html
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> 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