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

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

Closed
wohenbushuang opened this issue Mar 27, 2024 · 0 comments · Fixed by #3433
Closed

Comments

@wohenbushuang
Copy link
Contributor

}
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.

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.

1 participant