Add Cache-Control to static files
authorMarius Gavrilescu <marius@ieval.ro>
Fri, 7 Feb 2014 15:56:39 +0000 (17:56 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Fri, 7 Feb 2014 15:56:39 +0000 (17:56 +0200)
app.psgi

index 20092c9bda0da036e7597ce1da2eddbad3530357..5bed878e4767c9806ea4aeba7e533b3278f68ba6 100644 (file)
--- a/app.psgi
+++ b/app.psgi
@@ -55,7 +55,8 @@ sub authenticate {
 
 builder {
        enable 'ContentLength';
-       enable 'Static', path => qr,/static/,;
+       enable_if { $_[0]->{PATH_INFO} =~ qr,^/static/,} Header => set => ['Cache-Control', 'public, max-age=604800'];
+       enable 'Static', path => qr,^/static/,;
        enable 'Log4perl', category => 'plack', conf => 'log.conf';
        enable \&require_admin;
        enable_if \&some_auth_required, 'Auth::Basic', authenticator => \&authenticate, realm => 'Gruntmaster 6000';
This page took 0.009902 seconds and 4 git commands to generate.