Set Expires headers for Hydra's binary cache

This allows caching by reverse proxies.
This commit is contained in:
Eelco Dolstra
2014-11-06 14:31:04 +01:00
parent 55eb55478d
commit c250407f3c
4 changed files with 17 additions and 0 deletions

View File

@ -5,6 +5,7 @@ use base qw/Catalyst::View/;
use File::Basename;
use Nix::Store;
use Nix::Crypto;
use Hydra::Helper::CatalystUtils;
sub process {
my ($self, $c) = @_;
@ -39,6 +40,8 @@ sub process {
$info .= "Signature: 1;$keyName;$sig\n";
}
setCacheHeaders($c, 24 * 60 * 60);
$c->response->body($info);
return 1;

View File

@ -2,6 +2,7 @@ package Hydra::View::NixNAR;
use strict;
use base qw/Catalyst::View/;
use Hydra::Helper::CatalystUtils;
sub process {
my ($self, $c) = @_;
@ -14,6 +15,8 @@ sub process {
open $fh, "nix-store --dump '$storePath' | bzip2 |";
setCacheHeaders($c, 365 * 24 * 60 * 60);
$c->response->body($fh);
return 1;