From 142b1c3262d7c4a61fa7a80254a6a82506d74d23 Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Thu, 21 Jun 2018 16:15:06 -0400 Subject: cache headers for static assets --- Bugzilla/Quantum.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Bugzilla/Quantum.pm b/Bugzilla/Quantum.pm index e1cf94f2c..2519e23ad 100644 --- a/Bugzilla/Quantum.pm +++ b/Bugzilla/Quantum.pm @@ -34,6 +34,15 @@ sub startup { $self->plugin('Bugzilla::Quantum::Plugin::Hostage'); $self->plugin('Bugzilla::Quantum::Plugin::BlockIP'); + if ( $self->mode ne 'development' ) { + $self->hook( + after_static => sub { + my ($c) = @_; + $c->res->headers->cache_control('public, max-age=31536000'); + } + ); + } + my $r = $self->routes; Bugzilla::Quantum::CGI->load_all($r); Bugzilla::Quantum::CGI->load_one('bzapi_cgi', 'extensions/BzAPI/bin/rest.cgi'); @@ -47,9 +56,10 @@ sub startup { $r->get( '/__lbheartbeat__' => sub { my $c = shift; - $c->reply->file($c->app->home->child('__lbheartbeat__')); + $c->reply->file( $c->app->home->child('__lbheartbeat__') ); }, ); + $r->get('/__heartbeat__')->to( 'CGI#heartbeat_cgi'); $r->get('/robots.txt')->to( 'CGI#robots_cgi' ); -- cgit v1.2.3-24-g4f1b