fix: cache immutable blobs served from /files

Page and cover blobs are content-addressed by unguessable, immutable keys,
but /files sent no Cache-Control, so the browser refetched on every reader
open — defeating the whole-chapter and next-chapter preloading (and re-
proxying every byte through the node server in prod). Send
`Cache-Control: public, max-age=31536000, immutable`.

Bump to 0.124.3.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-07-07 20:30:03 +02:00
parent 379224bee4
commit b0500e8e48
5 changed files with 20 additions and 3 deletions

View File

@@ -172,6 +172,13 @@ async fn files_endpoint_streams_in_multiple_frames(pool: PgPool) {
resp.headers().get("x-content-type-options").unwrap(),
"nosniff"
);
// Blobs are content-addressed by unguessable, immutable keys, so they're
// safe to cache forever — this is what makes the reader's page + next-
// chapter preloading actually hit cache instead of re-downloading.
assert_eq!(
resp.headers().get(header::CACHE_CONTROL).unwrap(),
"public, max-age=31536000, immutable"
);
let mut body = resp.into_body();
let mut frames = 0usize;