-
-
Notifications
You must be signed in to change notification settings - Fork 115
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
5.x.x
Plugin version
8.x.x
Node.js version
20
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
rhel8 and ms windows
Description
When using the default json list for directories and fastify static trailing slashes trigger a reply-already sent error internally.
// fastify
import path from "node:path";
import Fastify from "fastify";
import FastifyStatic from "@fastify/static";
const fastify = Fastify({ logger: { level: "trace" } });
const pwd = process.cwd();
const root = path.join(pwd, "/node_modules");
console.log(root);
fastify
.register(FastifyStatic, {
root,
redirect: false, // redirect true makes problem always happen
prefix: "/node_modules",
index: false,
list: true,
})
.listen({ port: 3000 }, (err) => {
if (err) throw err;
});
// dir routes give me a 'already sent' error msg!
// NO PROBLEMO:
// http://localhost:3000/node_modules/@fastify <-- no trailing slash
// HAS PROBLEM:
// http://localhost:3000/node_modules/ <-- trailing slash
// http://localhost:3000/node_modules/@fastify/ <-- trailing slashLink to code that reproduces the bug
Expected Behavior
not throw an error or document how I am supposed to configure this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels