From: Marius Gavrilescu Date: Sat, 18 Apr 2015 09:13:05 +0000 (+0300) Subject: Revert "Do not handle static files (nginx does this already)" X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=bbf6a6cc766aee908795a80fa6d14190086fbcad;p=plack-app-gruntmaster.git Revert "Do not handle static files (nginx does this already)" This reverts commit cbae57719c80843e922c3a1b248a56b8e8bff5b6. Conflicts: app.psgi --- diff --git a/app.psgi b/app.psgi index a13a73e..837dd60 100644 --- a/app.psgi +++ b/app.psgi @@ -41,6 +41,7 @@ sub add_headers { my $resp = $app->($_[0]); my $hdrs = Plack::Util::headers($resp->[1]); $hdrs->set('Content-Security-Policy', CONTENT_SECURITY_POLICY); + $hdrs->set('Cache-Control', 'public, max-age=604800') if $_[0]->{PATH_INFO} =~ qr,^/static/,; $resp->[1] = $hdrs->headers; $resp; } @@ -53,6 +54,7 @@ builder { enable_if { $_[0]->{PATH_INFO} eq '/ok' } sub { sub{ [200, [], []] }}; enable 'ContentLength'; enable \&add_headers; + enable 'Static', path => qr,^/static/,; enable 'Log4perl', category => 'plack'; enable \&add_database; enable '+Plack::App::Gruntmaster::Auth',