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.

s3: fix health check endpoints returning 404 for HEAD requests #8243 (#8248)

Chris Lube6b5db65aa7
diff --git a/weed/s3api/s3api_server.go b/weed/s3api/s3api_server.go
index 31ec60a090..faa0fb8d5f 100644
--- a/weed/s3api/s3api_server.go
+++ b/weed/s3api/s3api_server.go
@@ -434,8 +434,8 @@ func (s3a *S3ApiServer) registerRouter(router *mux.Router) {
s3a.registerS3TablesRoutes(apiRouter)
// Readiness Probe
- apiRouter.Methods(http.MethodGet).Path("/status").HandlerFunc(s3a.StatusHandler)
- apiRouter.Methods(http.MethodGet).Path("/healthz").HandlerFunc(s3a.StatusHandler)
+ apiRouter.Methods(http.MethodGet, http.MethodHead).Path("/status").HandlerFunc(s3a.StatusHandler)
+ apiRouter.Methods(http.MethodGet, http.MethodHead).Path("/healthz").HandlerFunc(s3a.StatusHandler)
// Object path pattern with (?s) flag to match newlines in object keys
const objectPath = "/{object:(?s).+}"
diff --git a/weed/storage/volume_read.go b/weed/storage/volume_read.go
index 376dafb441..9e27fb4b2b 100644
--- a/weed/storage/volume_read.go
+++ b/weed/storage/volume_read.go
@@ -265,7 +265,7 @@ func ScanVolumeFileFrom(version needle.Version, datBackend backend.BackendStorag
if err == io.EOF {
return nil
}
- return fmt.Errorf("cannot read needle header at offset %d: %v", offset, err)
+ return fmt.Errorf("cannot read needle header at offset %d: %w", offset, err)
}
glog.V(4).Infof("new entry needle size:%d rest:%d", n.Size, rest)
}