We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.27.4
4.5.0
16.13.0
Linux
21.04
I expect the index.html.bz file to be served when I request a directory without a trailing slash
I think the solution is to add code in
fastify-static/index.js
Line 175 in 84e66b1
findIndexFile
something like
let indexPathname = findIndexFile(pathname, options.root, options.index) if (!indexPathname) { return reply.callNotFound() } return pumpSendToReply( request, reply, indexPathname + '.' + getEncodingExtension(encoding), rootPath, undefined, undefined, checkedEncodings )
folder structure
public/SiteMap/index.html.bz public/SiteMap/index.html
Setup plugin with :
fastify.register(fastifyStatic, { root: resolve("public"), redirect: false, wildcard: true, preCompressed: true, })
Request
curl http://localhost:8080/SiteMap
(note no trailing slash)
Get a 404 error
I expect the public/SiteMap/index.html.bz file to be served for /SiteMap url
public/SiteMap/index.html.bz
The text was updated successfully, but these errors were encountered:
fix: precompressed index without trailing slash (fastify#270)
5c415b1
I have implemented a fix, can someone please review
Sorry, something went wrong.
fix: precompressed index without trailing slash (#270) (#271)
97a22ec
* fix: precompressed index without trailing slash (#270) * feat: move no trailing slash index ndex handler before dir list handler
Successfully merging a pull request may close this issue.
Prerequisites
Fastify version
3.27.4
Plugin version
4.5.0
Node.js version
16.13.0
Operating system
Linux
Operating system version (i.e. 20.04, 11.3, 10)
21.04
Description
I expect the index.html.bz file to be served when I request a directory without a trailing slash
I think the solution is to add code in
fastify-static/index.js
Line 175 in 84e66b1
findIndexFile
and re-tries the pumpSendToReply with a new path namesomething like
Steps to Reproduce
folder structure
Setup plugin with :
Request
curl http://localhost:8080/SiteMap
(note no trailing slash)
Get a 404 error
Expected Behavior
I expect the
public/SiteMap/index.html.bz
file to be served for /SiteMap urlThe text was updated successfully, but these errors were encountered: