DenoDDeno
Powered by
rajsiteR
Denoโ€ข4y agoโ€ข
17 replies
rajsite

Cache related headers not included in deno deploy for static file serving

I have a hello world level static site using
serveDir
serveDir
. When I run the site locally I see that Weak E-Tag headers are included in responses for the static files and can verify in dev tools that caching works.

When I deploy the site with deno deploy I don't see any caching and each request sends the full response to the browser. I can see that compression is running as described in the caching documentation but the docs seem to suggest that if Weak E-tags are included (which I assume is the case since that is how serveDir is behaving locally) that I would expect them in the responses.

- Any ideas on why deno deploy is not including caching headers in responses?
- Related, how can I get insights into the responses of my app before Deno's frontend (i.e. how can debug / confirm my server is still including E-Tags in it's responses before the Deno deploy gateway takes over).

Deno deploy caching docs: https://deno.com/deploy/docs/compression#what-happens-to-my-etag-header

Example app:
import { serve } from "https://deno.land/std@0.177.0/http/server.ts";
import { serveDir } from "https://deno.land/std@0.177.0/http/file_server.ts";

serve(async (req) => {
    return await serveDir(req);
});
import { serve } from "https://deno.land/std@0.177.0/http/server.ts";
import { serveDir } from "https://deno.land/std@0.177.0/http/file_server.ts";

serve(async (req) => {
    return await serveDir(req);
});

In a directory structure like the following:
index.html
other_static_stuff/
src/main.ts
src/deno.json
index.html
other_static_stuff/
src/main.ts
src/deno.json

Deployed using
deployctl
deployctl
with the current directory at the root of the path shown above and pointing to src/main.ts.

Can see an example deployed site here showing caching not working: https://rajsite-gnpsdwjvtpk0.deno.dev/
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Serving static website
Niranjan RameshNNiranjan Ramesh / help
3y ago
deno cache
begoonBbegoon / help
2y ago
deno-deploy limits on file storage?
shultz๐Ÿ‡ฎ๐Ÿ‡ฑSshultz๐Ÿ‡ฎ๐Ÿ‡ฑ / help
3y ago