[Catalyst] living without Apache 'deflate'

Andrew Rodland andrew at cleverdomain.org
Tue Apr 5 01:09:26 GMT 2011


On Monday, April 04, 2011 06:11:39 PM John M. Dlugosz wrote:
> Since fastcgi doesn't get along with the deflate module, I've turned it
> off, per the installation instructions and Catalyst tutorials.
> 
> But I'm wondering about SVG images.  Can I pre-compress the files on disk
> and have the browser see the same thing as the deflate wrapper around the
> actual content type?  That's certainly better for the server anyway,
> instead of deflating it on every request.

For starters: you don't need to do without mod_deflate. Just install a non-
broken version of mod_fastcgi (version SNAP-0811090952, from 2008, or newer).

But if somehow that's not an option, you can load 
Catalyst::Plugin::Compress::Deflate (of course you'd also need to use 
Catalyst::Plugin::Static::Simple as well, instead of allowing apache to serve 
those files directly).

Precompressing the files on disk *is* possible but there's a difficulty 
involved with the headers, since you can't send a deflated body without an 
appropriate Content-Transfer-Encoding, and you can't do it at all unless the 
client has sent an appropriate Accept header. Doing this right is a matter of 
a bit of programming, unless you can find a module that already does it for 
you.

Andrew



More information about the Catalyst mailing list