Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

lib/http: add default 404 handler

Nolan Woodse489a101f631
diff --git a/lib/http/http.go b/lib/http/http.go
index 25e5ff82d..61525bab4 100644
--- a/lib/http/http.go
+++ b/lib/http/http.go
@@ -173,6 +173,9 @@ func NewServer(listeners, tlsListeners []net.Listener, opt Options) (Server, err
router.MethodNotAllowed(func(w http.ResponseWriter, _ *http.Request) {
http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
})
+ router.NotFound(func(w http.ResponseWriter, _ *http.Request) {
+ http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
+ })
handler := router.(http.Handler)
if opt.BaseURL != "" {