Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

Handle preflight cors requests (#3481)

famosssbdba3da2e4c1
diff --git a/weed/s3api/s3api_server.go b/weed/s3api/s3api_server.go
index 0fc6af4f66..01bc102a1c 100644
--- a/weed/s3api/s3api_server.go
+++ b/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, ",")