Question

I am trying to enable gzip on a site and am currently testing it on a staging server, however I cannot seem to get it to actually use the compression.

I am looking for Content-Encoding: gzip or Content-Encoding: deflate

and am using this in my .htaccess from html5 boilerplace's htaccess:

<IfModule mod_deflate.c>

    # Force compression for mangled headers.
    # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping
    <IfModule mod_setenvif.c>
        <IfModule mod_headers.c>
            SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
            RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
        </IfModule>
    </IfModule>

    # Compress all output labeled with one of the following MIME-types
    # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
    #  and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
    #  as `AddOutputFilterByType` is still in the core directives).
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE application/atom+xml \
                                      application/javascript \
                                      application/json \
                                      application/ld+json \
                                      application/rss+xml \
                                      application/vnd.ms-fontobject \
                                      application/x-font-ttf \
                                      application/x-web-app-manifest+json \
                                      application/xhtml+xml \
                                      application/xml \
                                      font/opentype \
                                      image/svg+xml \
                                      image/x-icon \
                                      text/css \
                                      text/html \
                                      text/plain \
                                      text/x-component \
                                      text/xml
    </IfModule>

</IfModule>

I have tried simply enabling the minimum compression and still am not getting the responses I need:

AddOutputFilterByType DEFLATE text/html text/plain text/xml

Here is an example header from a .js file on the site:

HTTP/1.1 200 OK
Date: Wed, 05 Feb 2014 18:48:03 GMT
Server: Apache/2.2.25 (Unix) mod_ssl/2.2.25 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Vary: Host
Last-Modified: Wed, 05 Feb 2014 16:04:09 GMT
ETag: "fe34a-1566-4f1aae82f7040"
Accept-Ranges: bytes
Content-Length: 5478
X-UA-Compatible: IE=edge
X-Robots-Tag: noindex, nofollow
Cache-Control: max-age=2678400, public
Keep-Alive: timeout=5, max=91
Connection: Keep-Alive
Content-Type: application/javascript

I do not currently have access to .httpdconf so have been only using .htaccess, however I was quite sure that rackspace would have mod_deflate.c installed by default..any assistance would be greatly appreciated!

Was it helpful?

Solution

After getting access to eashapache through the rackspace cpanel, I found out that the server had been configured with very minimal settings, and in fact, mod_deflate.c was not enabled.

Thats what I get for assuming!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top