Skip to content

Commit 0d9fd41

Browse files
committed
fix: relax caching policy for non-image static assets
1 parent bb8de6e commit 0d9fd41

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

content/articles/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,23 @@ Open Pull request following the previews step and for any help
7171
- The folder name in `/public/articles` must **exactly match** your markdown filename (without the .md extension)
7272
- Use descriptive file names for your additional images
7373
- Optimize your images for web before adding them to keep page load times fast
74+
75+
## Caching Policy
76+
77+
Static assets have different caching behaviors:
78+
79+
**Images** (`.jpg`, `.jpeg`, `.png`, `.gif`, `.webp`, `.svg`, `.avif`) are cached aggressively with `immutable` headers for 1 year. This means once a user downloads an image, their browser will not re-request it.
80+
81+
**Documents** (`.pdf`, etc.) use default browser caching, allowing updates to propagate within hours/days.
82+
83+
### Updating Static Assets
84+
85+
If you need to update an existing static file (image, PDF, etc.), follow the **cache-busting pattern**:
86+
87+
1. **Do not replace the file in-place**, users with cached versions won't see updates
88+
2. **Use a versioned filename**, rename `report.pdf` to `report-v2.pdf`
89+
3. **Update all references** to point to the new filename
90+
91+
This follows [Mozilla's recommendation](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#immutable) for immutable resources: include version/hashes in URLs rather than modifying existing files.
92+
93+
See [issue #607](https://github.com/privacy-ethereum/pse.dev/issues/607) for context on this policy.

next.config.mjs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,6 @@ const nextConfig = {
9494
},
9595
],
9696
},
97-
{
98-
source: "/articles/:path*",
99-
headers: [
100-
{
101-
key: "Cache-Control",
102-
value: "public, max-age=31536000, immutable",
103-
},
104-
],
105-
},
10697
]
10798
},
10899
// Configure compiler for modern browsers

0 commit comments

Comments
 (0)