From 308f424b48c9ff682579941058ada15187a448a3 Mon Sep 17 00:00:00 2001 From: Lars Trieloff Date: Fri, 15 Mar 2019 13:03:08 +0000 Subject: [PATCH] Vary on X-Request-Type to prevent Dynamic 404s to be counted against Static refetches, fixes #45 (potentially badly) --- layouts/fastly/helix.vcl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/layouts/fastly/helix.vcl b/layouts/fastly/helix.vcl index f71a2fe7..724aaebb 100644 --- a/layouts/fastly/helix.vcl +++ b/layouts/fastly/helix.vcl @@ -860,6 +860,12 @@ sub vcl_fetch { set beresp.http.Vary = beresp.http.Vary + ",X-Strain"; } + # Vary on Request-Type, so that static requests don't interfere with + # dynamic requests: https://github.com/adobe/helix-publish/issues/45 + if (beresp.http.Vary !~ "X-Request-Type") { + set beresp.http.Vary = beresp.http.Vary + ",X-Request-Type"; + } + # TODO: Add Surrogate-Keys, based on req.url/X-Orig-URL if (beresp.http.Expires || beresp.http.Surrogate-Control ~ "max-age" || beresp.http.Cache-Control ~ "(s-maxage|max-age)") {