Add etag for immutable assets

This commit is contained in:
Jon Staab
2026-05-12 08:46:50 -07:00
parent 0998639d59
commit ab21008f34
2 changed files with 10 additions and 2 deletions
+2 -2
View File
@@ -37,12 +37,12 @@ pnpm run start
Or, if you prefer to use a container:
```sh
docker run -d -p 3000:3000 ghcr.io/coracle-social/flotilla:latest
docker run -d -p 3000:3000 gitea.coracle.social/coracle/flotilla:latest
```
Alternatively, you can copy the build files into a directory of your choice and serve it yourself:
```sh
mkdir ./mount
docker run -v ./mount:/app/mount ghcr.io/coracle-social/flotilla:latest bash -c 'cp -r build/* mount'
docker run -v ./mount:/app/mount gitea.coracle.social/coracle/flotilla:latest bash -c 'cp -r build/* mount'
```
+8
View File
@@ -247,6 +247,14 @@ app.use(
: "public, max-age=3600"
context.header("Cache-Control", cacheControl)
// Immutable assets are content-hashed by Vite, so the filename is itself a
// stable content identifier. Exposing it as an ETag lets clients that
// revalidate explicitly (e.g. emoji-picker-element checks its data source
// on every load) skip re-downloading large files when nothing changed.
if (isImmutable) {
context.header("ETag", `"${path.basename(filePath)}"`)
}
},
}),
)