You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2004/09/09 16:53:50 UTC

DO NOT REPLY [Bug 31145] New: - Patch for using mod_deflate to serve pre-compressed pages

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31145>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31145

Patch for using mod_deflate to serve pre-compressed pages

           Summary: Patch for using mod_deflate to serve pre-compressed
                    pages
           Product: Apache httpd-2.0
           Version: 2.0-HEAD
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: mod_deflate
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: skrul@yahoo.com


I want to serve pre-compressed pages rather than using mod_deflate to compress
the pages on the fly.  However, I also want to send uncompressed pages to
browsers that have buggy support for compressed pages and browsers that do not
state that they accept compressed pages.  The included patch and the following
configuration make this possible.  Setting the environment variable
"force-gunzip" will bypass mod_deflate's checking of the content type of the
selected document before it uncompresses it.  I need this because my compressed
files do not end in ".gz".  Also, setting the environment variable "no-gunzip"
causes mod_deflate not to uncompress the selected document.

# We always serve compressed data, so add the appropriate header
Header append Content-Encoding gzip

# If the request includes Accept-Encoding: gzip and is a browser that
# works with compressed input, tell mod_deflate not to inflate the content
SetOutputFilter INFLATE

# Skip the content encoding sanity check that verifies that the content
# that we might be gunzipping is actually gzipped.  We do this becase we
# know all of our content is gzipped, but since we don't add the .gz
# extension, the content encoding header does not get set.
SetEnv force-gunzip 1

# Since all of our content is compressed, we never want to gunzip the
# content unless we have a request from a known incompatible browser
# or the request does not state that gzipped content is acceptable
# in the Accept-Encoding header

# Always gunzip the response for Netscpae 4.x, but don't mistakenly include
# IE.  This is based on the mod_deflate setup in the documentation at:
# http://httpd.apache.org/docs-2.0/mod/mod_deflate.html
SetEnv bad-browser=0
BrowserMatch ^Mozilla/4 bad-browser=1
BrowserMatch \bMSIE bad-browser=0

# If the browser can accept gzip encoding, don't gunip the response
SetEnvIf Accept-Encoding gzip no-gunzip

# But if it is a bad browser, re-enable ungzipping by clearing the
# no-gunzip environment variable
SetEnvIf bad-browser 1 !no-gunzip

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org