Skip to content

need Access-Control-Expose-Headers: Content-Disposition header in ServeFileDownload #3432

@wohenbushuang

Description

@wohenbushuang

}
r.Header().Set("Content-Type", "application/force-download")
r.Header().Set("Accept-Ranges", "bytes")
r.Header().Set("Content-Disposition", fmt.Sprintf(`attachment;filename=%s`, url.QueryEscape(downloadName)))
r.Server.serveFile(r.Request, serveFile)
}

As mentioned in axios/axios#895 and https://stackoverflow.com/questions/43912862/axios-expose-response-headers-content-disposition , the server side has to enable CORS-related feature for axios request to read Content-Disposition header, so the file can be downloaded with the given filename.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions