From 4f8ff095514b75fc72a54be36d2e3d923db97988 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Sat, 2 Feb 2019 18:36:20 -0700 Subject: [PATCH] staticfiles: Require method GET Other methods are not currently implemented in the static file server --- caddyhttp/staticfiles/fileserver.go | 3 +++ 1 file changed, 3 insertions(+) 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) }