forked from coracle/flotilla
Add etag for immutable assets
This commit is contained in:
@@ -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'
|
||||
```
|
||||
|
||||
@@ -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)}"`)
|
||||
}
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user