output filter

output filter

am 28.01.2010 16:27:29 von moli

Hello,

How to set the filter for some output headers?
I want to add some Expire: and Cache-Control: headers to make
downstream cacheserver to cache the pages.
Though they are dynamic pages, but I think they are safe to be cachable.

Thanks.

Re: output filter

am 28.01.2010 17:00:26 von torsten.foertsch

On Thursday 28 January 2010 16:27:29 moli@normalperson.e4ward.com wrote:
> How to set the filter for some output headers?
> I want to add some Expire: and Cache-Control: headers to make
> downstream cacheserver to cache the pages.
> Though they are dynamic pages, but I think they are safe to be cachable.
>
PerlOutputFilter "sub { \
use strict; \
use Apache2::Filter (); \
use Apache2::RequestRec (); \
use Apache2::Const -compile=>qw/DECLINED/; \
my ($f)=@_; \
@{$f->r->headers_out}{qw/Expire Cache-Control/}= \
(q{...}, q{...}); \
$f->remove; \
return Apache2::Const::DECLINED; \
}"

Fill in the 2 ellipses.

Torsten

Re: output filter

am 28.01.2010 17:31:35 von Perrin Harkins

On Thu, Jan 28, 2010 at 10:27 AM, wrote:
> I want to add some Expire: and Cache-Control: headers to make
> downstream cacheserver to cache the pages.
> Though they are dynamic pages, but I think they are safe to be cachable.

If you're generating them with mod_perl, you can just set the headers
in your response handler. You only need an output filter if some of
them are coming from another source, like PHP.

- Perrin

Re: output filter

am 29.01.2010 08:46:50 von moli

Thanks all.
Yes the whole pages are generated from mod_perl not PHP.

BTW, though we are still using modperl for developing some applications.
But it seems other instead technologies are becoming more and more
popular, like PHP,Django,Rails etc.
Is modperl outdated in today?

Regards.

Re: output filter

am 29.01.2010 11:35:26 von William T

On Thu, Jan 28, 2010 at 11:46 PM, wrote:
> BTW, though we are still using modperl for developing some applications.
> But it seems other instead technologies are becoming more and more
> popular, like PHP,Django,Rails etc.
> Is modperl =A0outdated in today?

I don't know that PHP is becoming more popular, I think it's
popularity is actually waning. While Django, and Rails are certainly
popular, I don't think it necessarily follows that modperl is
outdated. It certainly performs better than Django and Rails, but
that isn't necessarily a hard requirement for many places. It's
probably more of business decision these days. Which technology do
your employees know the best, and what's the availability of people
who know that technology in the job market? The pluses and minuses to
each language and technology mostly even out. Chances are if you are
writing webapps your not really going to run across large
differentiating factors between the technologies.

-wjt