xiven.com stating the blatantly obvious since 2002

Zippy

A little warning to those of you who serve web pages with an application/xhtml+xml Content-type and who also use Apache's mod_gzip.

Make sure it's not set to only compress text files.

The following in a .htaccess file should do the trick:

<IfModule mod_gzip.c>
mod_gzip_item_include mime ^application/xhtml\+xml
</IfModule>

Thanks to Kam for figuring out why my web pages weren't being compressed, my pages are now ~3 times quicker to download ☺

Posted: 2003-05-14 14:20:30 UTC by Xiven | Cross-references (0) | Comments (7)

Cross-references

None

Comments

  • Freaky (2003-05-15 08:33:15 UTC)

    Don't forget the Vary header. In this case, "Vary: Accept, Accept-Encoding". If you're doing browser sniffing (tsk), you'll want User-Agent in there too.

  • Xiven (Registered) (2003-05-15 09:02:50 UTC)

    The Vary header is already added by mod_gzip as defined in the configuration used by my web host. It might be better to generate it myself though so I can include Vary: Accept (it just does Vary: Accept-encoding)

  • Freaky (2003-05-15 17:51:54 UTC)

    mod_gzip only appears to add it when it's actually serving gzipped content, hence why it didn't appear when I used HEAD(1) on xiven.com. Tsk, it's enough to make a purist cringe ;)

  • Jacques Distler (2003-05-16 21:50:20 UTC)

    A quick way to see if your page is being served compressed:

    Do a "View Info" on the page in Mozilla. If the "Size: ..." is given, then the page is being served uncompressed. If it says "Size: Unknown", then your page is being served compressed.


    For mod_deflate, the corresponding webserver configuration would say something like:

    <IfModule mod_deflate.c>
    DeflateFilterNote ratio
    DeflateCompressionLevel 5
    AddOutputFilterByType DEFLATE text/* application/xhtml+xml application/postscript
    </IfModule>

  • Freaky (2003-05-17 09:07:52 UTC)

    In Opera, you can compare page size with the size it gives for inline elements.. if the page is smaller than the size of the elements it contains, you can assume it's compressed :)

  • jacob (2003-07-09 09:35:57 UTC)

    You can also use the LiveHTTPHeaders extension with Mozilla/Firebird to see if your page is compressed. Look for something in the response headers like "Content-Encoding: gzip."

    For what it's worth, the build of Firebird that I use shows a value for Size even if the page is compressed.

  • Xiven (Registered) (2003-07-10 16:58:27 UTC)

    Yeah, I already use LiveHTTPHeaders. It's the single most useful extension for me at the moment (HTTP Digest Authentication is one of my current projects).