Browse Source

Handle preflight cors requests (#3481)

pull/3483/head
famosss 2 years ago
committed by GitHub
parent
commit
bdba3da2e4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      weed/s3api/s3api_server.go

7
weed/s3api/s3api_server.go

@ -87,6 +87,13 @@ func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
// Readiness Probe
apiRouter.Methods("GET").Path("/status").HandlerFunc(s3a.StatusHandler)
apiRouter.Methods("OPTIONS").HandlerFunc(
func(w http.ResponseWriter, r *http.Request){
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Credentials", "true")
writeSuccessResponseEmpty(w, r)
})
var routers []*mux.Router
if s3a.option.DomainName != "" {
domainNames := strings.Split(s3a.option.DomainName, ",")

Loading…
Cancel
Save