diff --git a/examples/basic-host/serve.ts b/examples/basic-host/serve.ts index bc3fbff14..941a8c846 100644 --- a/examples/basic-host/serve.ts +++ b/examples/basic-host/serve.ts @@ -124,7 +124,9 @@ sandboxApp.get(["/", "/sandbox.html"], (req, res) => { res.setHeader("Pragma", "no-cache"); res.setHeader("Expires", "0"); - res.sendFile(join(DIRECTORY, "sandbox.html")); + // With `root`, only the relative path is checked for dotfiles. An absolute path would 404 + // whenever any directory above DIRECTORY starts with a dot (e.g. `.cache/`). + res.sendFile("sandbox.html", { root: DIRECTORY }); }); sandboxApp.use((_req, res) => {