From 7eb15b19694e165a13bb59b0c18f89121b5d452f Mon Sep 17 00:00:00 2001 From: famosss Date: Tue, 23 Aug 2022 14:39:34 +0800 Subject: [PATCH] fix:Handle preflight cors requests (#3496) --- weed/s3api/s3api_server.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/weed/s3api/s3api_server.go b/weed/s3api/s3api_server.go index 01bc102a1..31ee1dc92 100644 --- a/weed/s3api/s3api_server.go +++ b/weed/s3api/s3api_server.go @@ -88,9 +88,11 @@ func (s3a *S3ApiServer) registerRouter(router *mux.Router) { apiRouter.Methods("GET").Path("/status").HandlerFunc(s3a.StatusHandler) apiRouter.Methods("OPTIONS").HandlerFunc( - func(w http.ResponseWriter, r *http.Request){ + func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Access-Control-Allow-Origin", "*") - w.Header().Set("Access-Control-Allow-Credentials", "true") + w.Header().Set("Access-Control-Expose-Headers", "*") + w.Header().Set("Access-Control-Allow-Methods", "*") + w.Header().Set("Access-Control-Allow-Headers", "*") writeSuccessResponseEmpty(w, r) })