NAME Plack::Middleware::Deflater - Compress response body with
Gzip or Deflate SYNOPSIS use Plack::Builder; builder { enable
sub { my $app = shift; sub { my $env = shift; my $ua =
$env->{HTTP_USER_AGENT} || ''; # Netscape has some problem
$env->{"psgix.compress-only-text/html"} = 1 if $ua =~
m!^Mozilla/4!; # Netscape 4.06-4.08 have some more problems
$env->{""} = 1 if $ua =~ m!^Mozilla/4\.0[678]!; # MSIE (7|8)
masquerades as Netscape, but it is fine if ( $ua =~ m!\bMSIE
(?:7|8)! ) { $env->{""} = 0; $env->{"psgix.compress-only-
text/html"} = 0; } $app->($env); } }; enable "Deflater",
content_type => ['text/css','text/html','text/javascript','appli
cation/javascript'], vary_user_agent => 1; sub { [200,['Content-
Type','text/html'],["OK"]] } }; DESCRIPTION
Plack::Middleware::Deflater is a middleware to encode your
response body in gzip or deflate, based on "Accept-Encoding"
HTTP request header. It would save the bandwidth a little bit
but should increase the Plack server load, so ideally you should
handle this on t