Skip to content

Commit

Permalink
examples: update basic example cache control
Browse files Browse the repository at this point in the history
Signed-off-by: Logan McAnsh <[email protected]>
  • Loading branch information
mcansh authored Oct 29, 2024
1 parent 15cfd4f commit 11e0fa9
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions examples/basic/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if (process.env.NODE_ENV === "production") {
prefix: "/",
wildcard: false,
decorateReply: false,
cacheControl: true,
cacheControl: false,
dotfiles: "allow",
etag: true,
serveDotFiles: true,
Expand All @@ -67,18 +67,12 @@ await app.register(fastifyStatic, {
root: BUILD_DIR,
prefix: "/",
wildcard: false,
cacheControl: true,
cacheControl: false,
dotfiles: "allow",
etag: true,
serveDotFiles: true,
lastModified: true,
setHeaders(res, filepath) {
let isAsset = filepath.startsWith(BUILD_DIR);
res.setHeader(
"cache-control",
isAsset ? ASSET_CACHE_CONTROL : DEFAULT_CACHE_CONTROL,
);
},
setHeaders,
});

app.register(async function createRemixRequestHandler(childServer) {
Expand Down

0 comments on commit 11e0fa9

Please sign in to comment.