httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Denninger <>
Subject [users@httpd] Question regarding mod_deflate and CGI output
Date Tue, 28 Aug 2007 01:10:11 GMT
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 (

%SPAMBLOCK-SYS: Matched [], message ok

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message