Skip to content

Serve static files with correct mime type for download #385

@qount25

Description

@qount25

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions