diff --git a/weed/server/filer_server_handlers_read.go b/weed/server/filer_server_handlers_read.go index fe9aa4586..0af1cf341 100644 --- a/weed/server/filer_server_handlers_read.go +++ b/weed/server/filer_server_handlers_read.go @@ -91,6 +91,10 @@ func (fs *FilerServer) listDirectoryHandler(w http.ResponseWriter, r *http.Reque } func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request, isGetMethod bool) { + w.Header().Set("Access-Control-Allow-Origin", "*") + w.Header().Set("Access-Control-Allow-Methods", "GET") + w.Header().Set("Access-Control-Max-Age", "1000") + if strings.HasSuffix(r.URL.Path, "/") { if fs.disableDirListing { w.WriteHeader(http.StatusMethodNotAllowed) diff --git a/weed/server/volume_server_handlers_read.go b/weed/server/volume_server_handlers_read.go index f021aba7f..8a15b2b90 100644 --- a/weed/server/volume_server_handlers_read.go +++ b/weed/server/volume_server_handlers_read.go @@ -33,6 +33,10 @@ type JsonEncode struct { } func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Access-Control-Allow-Origin", "*") + w.Header().Set("Access-Control-Allow-Methods", "GET") + w.Header().Set("Access-Control-Max-Age", "1000") + n := new(storage.Needle) vid, fid, filename, ext, _ := parseURLPath(r.URL.Path) volumeId, err := storage.NewVolumeId(vid)