Take the following files within the root directory:
index.html
sub/index.html
Configure fastify-static to include index: 'index.html'. In this case http://localhost/ serves the root index.html, http://localhost/sub/ serves sub/index.html. But http://localhost/sub is a 404 error. Would you accept an option that would hook send.on('directory') to perform a 301 redirect of such requests to the path including the trialing slash? Such that http://localhost/sub would be 301 with Location: http://localhost/sub/. I haven't tested this yet but the send documentation tells how to accomplish this. I'm assuming that directory redirects would need to be opt-in rather than opt-out? Either would be fine with me, just figured I'd ask since fastify-static is in the middle of a semver-major release.
Take the following files within the root directory:
Configure fastify-static to include
index: 'index.html'. In this casehttp://localhost/serves the rootindex.html,http://localhost/sub/servessub/index.html. Buthttp://localhost/subis a 404 error. Would you accept an option that would hooksend.on('directory')to perform a 301 redirect of such requests to the path including the trialing slash? Such thathttp://localhost/subwould be 301 withLocation: http://localhost/sub/. I haven't tested this yet but thesenddocumentation tells how to accomplish this. I'm assuming that directory redirects would need to be opt-in rather than opt-out? Either would be fine with me, just figured I'd ask since fastify-static is in the middle of a semver-major release.