aboutsummaryrefslogtreecommitdiff
path: root/weed/server/common.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2021-12-15 13:18:53 -0800
committerchrislu <chris.lu@gmail.com>2021-12-15 13:18:53 -0800
commit7210558c7bb6efbd8377975918143478a14c5b3c (patch)
tree4a7c60dc994999ce8f25db2add95dc49ba9c10fe /weed/server/common.go
parentbf4d7affc06d8cf04bb5403da3b9f3e6111e07f8 (diff)
downloadseaweedfs-7210558c7bb6efbd8377975918143478a14c5b3c.tar.xz
seaweedfs-7210558c7bb6efbd8377975918143478a14c5b3c.zip
s3: pass through s3 presigned headers
fix https://github.com/chrislusf/seaweedfs/discussions/2502
Diffstat (limited to 'weed/server/common.go')
-rw-r--r--weed/server/common.go16
1 files changed, 10 insertions, 6 deletions
diff --git a/weed/server/common.go b/weed/server/common.go
index 16213689d..ba4d13456 100644
--- a/weed/server/common.go
+++ b/weed/server/common.go
@@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
+ xhttp "github.com/chrislusf/seaweedfs/weed/s3api/http"
"io"
"io/fs"
"mime/multipart"
@@ -250,13 +251,16 @@ func handleStaticResources2(r *mux.Router) {
r.PathPrefix("/seaweedfsstatic/").Handler(http.StripPrefix("/seaweedfsstatic", http.FileServer(http.FS(StaticFS))))
}
-func adjustHeaderContentDisposition(w http.ResponseWriter, r *http.Request, filename string) {
- responseContentDisposition := r.FormValue("response-content-disposition")
- if responseContentDisposition != "" {
- w.Header().Set("Content-Disposition", responseContentDisposition)
- return
+func adjustPassthroughHeaders(w http.ResponseWriter, r *http.Request, filename string) {
+ for header, values := range r.Header {
+ if normalizedHeader, ok := xhttp.PassThroughHeaders[strings.ToLower(header)]; ok {
+ w.Header()[normalizedHeader] = values
+ }
}
- if w.Header().Get("Content-Disposition") != "" {
+ adjustHeaderContentDisposition(w, r, filename)
+}
+func adjustHeaderContentDisposition(w http.ResponseWriter, r *http.Request, filename string) {
+ if contentDisposition := w.Header().Get("Content-Disposition"); contentDisposition != "" {
return
}
if filename != "" {