|
8 | 8 | Permissions-Policy: accelerometer=(), autoplay=(), camera=(), encrypted-media=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), payment=(), picture-in-picture=(), usb=(), web-share=(), xr-spatial-tracking=(), screen-wake-lock=(), clipboard-write=(self), fullscreen=(self) |
9 | 9 | Cross-Origin-Opener-Policy: same-origin |
10 | 10 |
|
11 | | -# Immutable assets |
| 11 | +# Immutable assets — content-hashed filenames, safe to cache forever. |
| 12 | +# 63072000 = 2 years. immutable = never even revalidate. |
12 | 13 |
|
13 | 14 | /_astro/* |
14 | 15 | Cache-Control: public, max-age=63072000, immutable |
15 | 16 |
|
| 17 | +# Fonts are versioned in the filename (lora-v36, open-sans-v43), not |
| 18 | +# content-hashed. 2 years is fine as long as we never edit a file in place. |
16 | 19 | /fonts/* |
17 | 20 | Cache-Control: public, max-age=63072000, immutable |
18 | 21 |
|
19 | | -# Rarely changing |
| 22 | +# Rarely changing, unhashed assets |
20 | 23 |
|
| 24 | +# 604800 = 7 days |
21 | 25 | /videos/* |
22 | 26 | Cache-Control: public, max-age=604800 |
23 | 27 |
|
| 28 | +# 86400 = 1 day |
24 | 29 | /favicon/* |
25 | 30 | Cache-Control: public, max-age=86400 |
26 | 31 |
|
| 32 | +# 86400 = 1 day — OG images are rebuilt from posts on deploy |
27 | 33 | /og/*.png |
28 | 34 | Cache-Control: public, max-age=86400 |
29 | 35 |
|
30 | | -# Homepage & list pages — short CDN TTL |
| 36 | +# Homepage & list pages — must show new posts soon after publish. |
| 37 | +# A redeploy does NOT purge the edge cache (same URL), so s-maxage is the |
| 38 | +# real staleness ceiling. Keep it short for lists. |
| 39 | +# max-age=0 browser always revalidates (cheap 304, always fresh) |
| 40 | +# s-maxage=3600 CDN serves cached for 1 hour |
| 41 | +# swr=86400 CDN may serve stale up to 1 day while refetching |
31 | 42 |
|
32 | 43 | / |
33 | | - Cache-Control: public, max-age=0, s-maxage=600, stale-while-revalidate=86400 |
| 44 | + Cache-Control: public, max-age=0, s-maxage=3600, stale-while-revalidate=86400 |
34 | 45 | /projects |
35 | | - Cache-Control: public, max-age=0, s-maxage=600, stale-while-revalidate=86400 |
| 46 | + Cache-Control: public, max-age=0, s-maxage=3600, stale-while-revalidate=86400 |
36 | 47 | /blog |
37 | | - Cache-Control: public, max-age=0, s-maxage=600, stale-while-revalidate=86400 |
| 48 | + Cache-Control: public, max-age=0, s-maxage=3600, stale-while-revalidate=86400 |
38 | 49 |
|
39 | | -# Detail pages — longer CDN TTL |
| 50 | +# Detail pages — change only on edit. |
| 51 | +# s-maxage=10800 CDN serves cached for 3 hours = max wait for a fix to show |
| 52 | +# swr=86400 CDN may serve stale up to 1 day while refetching |
40 | 53 |
|
41 | 54 | /projects/* |
42 | | - Cache-Control: public, max-age=0, s-maxage=3600, stale-while-revalidate=86400 |
| 55 | + Cache-Control: public, max-age=0, s-maxage=10800, stale-while-revalidate=86400 |
43 | 56 | /blog/* |
| 57 | + Cache-Control: public, max-age=0, s-maxage=10800, stale-while-revalidate=86400 |
| 58 | + |
| 59 | +# Feeds & crawler files (production-only output) |
| 60 | +# s-maxage=3600 CDN 1 hour; swr=86400 stale up to 1 day |
| 61 | + |
| 62 | +/rss.xml |
| 63 | + Cache-Control: public, max-age=0, s-maxage=3600, stale-while-revalidate=86400 |
| 64 | +/sitemap-*.xml |
44 | 65 | Cache-Control: public, max-age=0, s-maxage=3600, stale-while-revalidate=86400 |
45 | 66 |
|
| 67 | +# 86400 = 1 day |
| 68 | +/robots.txt |
| 69 | + Cache-Control: public, max-age=86400 |
| 70 | + |
0 commit comments