logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Plack::Middleware::Expires - mod_expires for plack

Author

       Masahiro Nagano <kazeburo {at} gmail.com>

Configurations

       content_type
             content_type => qr!^image!,
             content_type => 'text/css',
             content_type => [ 'text/css', 'application/javascript', qr!^image/! ]

           Content-Type header to apply Expires

           also "content_type" accept CodeRef

             content_type => sub { my $env = shift; return 1 if $env->{..} }

       Expires
           Same format as the Apache mod_expires

             expires => 'M3600' # last_modified + 1 hour
             expires => 'A86400' # access + 1 day
             expires => 'modification plus 3 years 3 month 3 day'
             expires => 'access plus 3 days'

Description

       Plack::Middleware::Expires is Apache's mod_expires for Plack.  This middleware controls the setting of
       Expires HTTP header and the max-age directive of the Cache-Control HTTP header in server responses.

       Note:

       •   Expires works only for successful response,

       •   If an Expires HTTP header exists already, it will not be overridden by this middleware.

License

       This  library  is  free  software;  you can redistribute it and/or modify it under the same terms as Perl
       itself.

perl v5.34.0                                       2022-06-16                    Plack::Middleware::Expires(3pm)

Name

       Plack::Middleware::Expires - mod_expires for plack

See Also

Synopsis

         use Plack::Builder;

         builder {
             enable 'Expires',
               content_type => qr!^image/!i,
               expires => 'access plus 3 months';
             $app;
         }

See Also