Skip to content

Commit

Permalink
Merge pull request #1000 from CPAN-API/leo/fastly
Browse files Browse the repository at this point in the history
Add Surrogate-Control header to stop fastly caching by accident
  • Loading branch information
oalders committed Nov 29, 2013
2 parents 8aa58c5 + 2a98089 commit 60b3613
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/MetaCPAN/Web/Controller/Root.pm
Expand Up @@ -81,6 +81,16 @@ sub end : ActionClass('RenderView') {
$c->stash->{api} = $c->config->{api};
$c->stash->{api_secure} = $c->config->{api_secure} || $c->config->{api};
$c->res->header( Vary => 'Cookie' );

unless(
# Already have something set for fastly
$c->res->header('Surrogate-Control') ||
# We'll use Last-Modified for now
$c->res->header('Last-Modified')
) {
# Make sure fastly doesn't cache anything by accident
$c->res->header('Surrogate-Control' => 0);
}
}

=head1 AUTHOR
Expand Down

0 comments on commit 60b3613

Please sign in to comment.