@quintype/framework 7.28.3 → 7.28.4-fix-fastly.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quintype/framework",
3
- "version": "7.28.3",
3
+ "version": "7.28.4-fix-fastly.0",
4
4
  "description": "Libraries to help build Quintype Node.js apps",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -18,6 +18,7 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
18
18
  if (cacheKeys === "DO_NOT_CACHE") {
19
19
  res.setHeader("Cache-Control", "private,no-cache,no-store,max-age=0");
20
20
  res.setHeader("Vary", "Accept-Encoding");
21
+ cdnProviderVal === "fastly" && res.setHeader('Surrogate-Control', 'private,no-cache,no-store,max-age=0');
21
22
  res.setHeader(
22
23
  "Content-Security-Policy",
23
24
  `default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +
@@ -46,6 +47,7 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
46
47
  );
47
48
  }
48
49
 
50
+
49
51
  res.setHeader("Vary", "Accept-Encoding");
50
52
 
51
53
  // Cloudflare Headers
@@ -54,6 +56,9 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
54
56
  // Akamai Headers
55
57
  cdnProviderVal === "akamai" && res.setHeader("Edge-Cache-Tag", _(cacheKeys).uniq().join(","));
56
58
 
59
+ // Fastly Headers
60
+ cdnProviderVal === "fastly" && res.setHeader("Surrogate-Control", `public,max-age=${maxAge},s-maxage=${sMaxAge},stale-while-revalidate=1000,stale-if-error=${STALE_IF_ERROR_CACHE_DURATION}`);
61
+
57
62
  res.setHeader("Surrogate-Key", _(cacheKeys).uniq().join(" "));
58
63
  res.setHeader(
59
64
  "Content-Security-Policy",
@@ -73,6 +78,7 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
73
78
  } else {
74
79
  res.setHeader("Cache-Control", "public,max-age=15,s-maxage=60,stale-while-revalidate=150,stale-if-error=3600");
75
80
  res.setHeader("Vary", "Accept-Encoding");
81
+ cdnProviderVal === "fastly" && res.setHeader("Surrogate-Control", "public,max-age=15,s-maxage=60,stale-while-revalidate=150,stale-if-error=3600");
76
82
  res.setHeader(
77
83
  "Content-Security-Policy",
78
84
  `default-src data: 'unsafe-inline' 'unsafe-eval' https: http:;` +