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

Serve static files with correct mime type for download #385

Open
qount25 opened this issue Feb 15, 2025 · 1 comment
Open

Serve static files with correct mime type for download #385

qount25 opened this issue Feb 15, 2025 · 1 comment

Comments

@qount25
Copy link

qount25 commented Feb 15, 2025

I'm using ServeFiles to let users download .mp4 files, but browsers start playing the files instead of forcing users to download them. Normally, this is solved by setting the correct mime type, but I'm not sure I understand where to do this. I was able to set mime type for one of my endpoints in one of handlers (unrelated to serving static files), but that's because I had access to http.ResponseWriter. How do I go about it with static files?

@qount25
Copy link
Author

qount25 commented Feb 16, 2025

Also, as a side question, I'd like to ask if it's possible to serve static files from the embedded FS with ServeFiles?

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

No branches or pull requests

1 participant