Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Commit

Permalink
fix(static): throw error for invalid resource paths
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff committed Apr 25, 2019
1 parent 1fe7ee8 commit 92d4c82
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions layouts/fastly/helix.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,15 @@ sub hlx_fetch_static {
set var.ext = ".hlx_" + digest.hash_sha1(beresp.http.ETag);

if (re.group.2 == var.ext) {
# tell the browser to keep them forever
set beresp.http.Cache-Control = "max-age=31622400,immutable"; # keep it for a year in the browser;
set beresp.http.Surrogate-Control = "max-age=3600"; # but only for an hour in the shared cache
# to limit cache poisioning
set beresp.http.Surrogate-Control = "max-age=31622400,immutable";
set beresp.cacheable = true;
set beresp.ttl = 3600s;
set beresp.ttl = 31622400s;
} else {
set beresp.ttl = 300s;
error 404 "Invalid";
set beresp.http.X-Trace = "etag=" + beresp.http.ETag + "; ext=" + var.ext;

}
return(deliver);
}
Expand Down

0 comments on commit 92d4c82

Please sign in to comment.