Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions server/handlers/cdn-caching.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
if (cacheKeys) {
if (cacheKeys === "DO_NOT_CACHE") {
res.setHeader("Cache-Control", "private,no-cache,no-store,max-age=0");
cdnProviderVal === "akamai" && res.setHeader("Edge-Control", "private,no-cache,no-store,max-age=0");
res.setHeader("Vary", "Accept-Encoding");
res.setHeader(
"Content-Security-Policy",
Expand All @@ -39,14 +38,11 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
"Cloudflare-CDN-Cache-Control",
`max-age=${sMaxAge}, stale-while-revalidate=1000, stale-if-error=14400`
);
cdnProviderVal === "akamai" && res.setHeader("Edge-Control", `public,maxage=${sMaxAge}`);
} else {
res.setHeader(
"Cache-Control",
`public,max-age=${maxAge},s-maxage=${sMaxAge},stale-while-revalidate=1000,stale-if-error=14400`
);
cdnProviderVal === "akamai" &&
res.setHeader("Edge-Control", `public,maxage=${sMaxAge},stale-while-revalidate=1000,stale-if-error=14400`);
}

res.setHeader("Vary", "Accept-Encoding");
Expand Down Expand Up @@ -75,8 +71,6 @@ exports.addCacheHeadersToResult = function addCacheHeadersToResult({
}
} else {
res.setHeader("Cache-Control", "public,max-age=15,s-maxage=60,stale-while-revalidate=150,stale-if-error=3600");
cdnProviderVal === "akamai" &&
res.setHeader("Edge-Control", "public,maxage=60,stale-while-revalidate=150,stale-if-error=3600");
res.setHeader("Vary", "Accept-Encoding");
res.setHeader(
"Content-Security-Policy",
Expand Down
17 changes: 0 additions & 17 deletions test/integration/isomorphic-handler-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -607,12 +607,10 @@ describe("Isomorphic Handler", function () {
.expect(200)
.then((res) => {
const cacheControl = res.header["cache-control"];
const edgeCacheControl = res.header["edge-control"];
const cacheTag = res.header["cache-tag"];
const edgeCacheTag = res.header["edge-cache-tag"];
const contentSecurityPolicy = res.header["content-security-policy"];
assert.equal(cacheControl, "private,no-cache,no-store,max-age=0");
assert.equal(edgeCacheControl, "private,no-cache,no-store,max-age=0");
assert.equal(cacheTag, undefined);
assert.equal(edgeCacheTag, undefined);
assert.equal(
Expand Down Expand Up @@ -650,17 +648,12 @@ describe("Isomorphic Handler", function () {
.expect(200)
.then((res) => {
const cacheControl = res.header["cache-control"];
const edgeCacheControl = res.header["edge-control"];
const edgeCacheTag = res.header["edge-cache-tag"];
const contentSecurityPolicy = res.header["content-security-policy"];
assert.equal(
cacheControl,
"public,max-age=15,s-maxage=60,stale-while-revalidate=150,stale-if-error=3600"
);
assert.equal(
edgeCacheControl,
"public,maxage=60,stale-while-revalidate=150,stale-if-error=3600"
);
assert.equal(edgeCacheTag, undefined);
assert.equal(
contentSecurityPolicy,
Expand Down Expand Up @@ -697,17 +690,12 @@ describe("Isomorphic Handler", function () {
.expect(200)
.then((res) => {
const cacheControl = res.header["cache-control"];
const edgeCacheControl = res.header["edge-control"];
const edgeCacheTag = res.header["edge-cache-tag"];
const contentSecurityPolicy = res.header["content-security-policy"];
assert.equal(
cacheControl,
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
);
assert.equal(
edgeCacheControl,
"public,maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
);
assert.equal(edgeCacheTag, "c/1/abcdefgh");
assert.equal(
contentSecurityPolicy,
Expand Down Expand Up @@ -744,17 +732,12 @@ describe("Isomorphic Handler", function () {
.expect(200)
.then((res) => {
const cacheControl = res.header["cache-control"];
const edgeCacheControl = res.header["edge-control"];
const edgeCacheTag = res.header["edge-cache-tag"];
const contentSecurityPolicy = res.header["content-security-policy"];
assert.equal(
cacheControl,
"public,max-age=15,s-maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
);
assert.equal(
edgeCacheControl,
"public,maxage=900,stale-while-revalidate=1000,stale-if-error=14400"
);
assert.equal(edgeCacheTag, "c/1/abcdefgh");
assert.equal(
contentSecurityPolicy,
Expand Down