Skip to content
New issue

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

Feature Request: sendFile without serving anything #20

Closed
ilyaigpetrov opened this issue Nov 20, 2017 · 4 comments · Fixed by #69
Closed

Feature Request: sendFile without serving anything #20

ilyaigpetrov opened this issue Nov 20, 2017 · 4 comments · Fixed by #69

Comments

@ilyaigpetrov
Copy link

On my site each user has subdomain:

ilya.mysite.com/his/file
homer.mysite.com/index.html

I can't just tell serve this folder, I first retrieve username (homer), then serve his folder (users/homer). Ideally I would like to use reply.sendFile(path), but couldn't do it without specifying root folder (and serving file I don't want to server). Would be nice to have reply.sendFile separately from everything else.

Thanks!

@allevo
Copy link
Member

allevo commented Nov 20, 2017

Hi!
Thank you for this suggestion.

Truly this plugin was born to serve static files in development mode: nodejs is not so good on serving static files. Use a reverse proxy like nginx or haproxy.

Anyway we can split this plugin in order to add sendFile method. But I'd like to wait fastify/fastify#466

@jsardev
Copy link
Contributor

jsardev commented Aug 16, 2018

This would be awesome! 👍

@mcollina
Copy link
Member

Would you like to send a PR?

Basically you should add an option that makes https://github.com/fastify/fastify-static/blob/master/index.js#L94-L96 optional.

@jsardev
Copy link
Contributor

jsardev commented Aug 16, 2018

@mcollina Here you are 😄

mcollina pushed a commit that referenced this issue Aug 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants