Skip to content

Commit 4b01727

Browse files
committed
chore: tweak assets cache
1 parent 9155c8c commit 4b01727

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

‎public/_headers‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@
3131

3232
/content/*
3333
Cache-Control: public,max-age=604800,stale-while-revalidate=604800
34+
35+
/home/*
36+
Cache-Control: public,max-age=604800,stale-while-revalidate=604800

‎scripts/smoke-test.mjs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ const checks = [
3333
{ path: "/api/search", type: "search-index" },
3434
{ path: "/sitemap.xml", type: "text", contains: "<urlset" },
3535
{ path: "/blog/feed.xml", type: "text", contains: "<rss" },
36+
{
37+
path: "/home/golden-hour-trail.png",
38+
type: "png",
39+
cacheControlIncludes: "public,max-age=604800,stale-while-revalidate=604800",
40+
openNextCacheAbsent: true,
41+
},
3642
{
3743
path: "/apple-touch-icon.png",
3844
type: "png",

‎scripts/static-headers.test.mjs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ test("generated homepage Open Graph image keeps its cache rule", async () => {
7474
assert.equal(headers.get("cache-control"), "public,max-age=86400,stale-while-revalidate=604800");
7575
});
7676

77+
test("homepage images stay fresh for one week", async () => {
78+
const headers = await readEffectiveHeaders("/home/golden-hour-trail.png");
79+
80+
assert.equal(headers.get("cache-control"), "public,max-age=604800,stale-while-revalidate=604800");
81+
});
82+
7783
test("generated homepage Open Graph image allows cross-origin reads", async () => {
7884
const headers = await readEffectiveHeaders("/og/home/image.png");
7985

0 commit comments

Comments
 (0)