diff --git a/caddyhttp/staticfiles/fileserver.go b/caddyhttp/staticfiles/fileserver.go index 91fb1a7f5..93a7c6d8f 100644 --- a/caddyhttp/staticfiles/fileserver.go +++ b/caddyhttp/staticfiles/fileserver.go @@ -53,6 +53,9 @@ type FileServer struct { // ServeHTTP serves static files for r according to fs's configuration. func (fs FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) { + if r.Method != "GET" { + return http.StatusMethodNotAllowed, nil + } return fs.serveFile(w, r) }