Practical mod_perl / HTML Book /



previous page: B.15.5. Apache::PassFile—Send File via OutputChain
  
page up: HTML Version of the book
  
next page: B.15.7. Apache::Compress—Auto-Compress Web Files with gzip

B.15.6. Apache::Gzip—Auto-Compress Web Files with gzip


Similar to Apache::GzipChain but works with Apache::Filter.

This configuration:

PerlModule Apache::Filter
<Files ~ "*\.html">
    SetHandler perl-script
    PerlSetVar Filter On
    PerlHandler Apache::Gzip
</Files>

will send all the *.html files compressed if the client accepts the compressed input.

And this one:

PerlModule Apache::Filter
Alias /home/http/perl /perl
<Location /perl>
    SetHandler perl-script
    PerlSetVar Filter On
    PerlHandler Apache::RegistryFilter Apache::Gzip
</Location>

will compess the output of the Apache::Registry scripts. Note that you should use Apache::RegistryFilter instead of Apache::Registry for this to work.

You can use as many filters as you want:

PerlModule Apache::Filter
<Files ~ "*\.fltr">
    SetHandler perl-script
    PerlSetVar Filter On
    PerlHandler Filter1 Filter2 Apache::Gzip
</Files>

You can test that it works by either looking at the size of the response in the access.log file or by telnet:

panic% telnet localhost 8000
Trying 127.0.0.1
Connected to 127.0.0.1
Escape character is '^]'.
GET /perl/test.pl HTTP 1.1
Accept-Encoding: gzip
User-Agent: Mozilla

You will get the data compressed if it's configured correctly.

 

Continue to:

  • prev: B.15.5. Apache::PassFile—Send File via OutputChain
  • Table of Contents
  • next: B.15.7. Apache::Compress—Auto-Compress Web Files with gzip







TOP
previous page: B.15.5. Apache::PassFile&#8212;Send File via OutputChain
  
page up: HTML Version of the book
  
next page: B.15.7. Apache::Compress&#8212;Auto-Compress Web Files with gzip


Menu

  • HTML Book
  • PDF Book
  • Download Code
  • Table of Contents
  • Errata
  • mod_perl2 User's Guide
  • Sitemap

Search


Add to Google




Creative Commons License


Written by
Eric Cholet (Logilune) and
Stas Bekman (StasoSphere & Free Books).


[ Privacy Policy | Terms of Use | About Us | Search ]

© 2007 StasoSphere.com