From 267257b68055684f8bff94e4ae78d4b9e9c93b0b Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Sat, 31 Dec 2016 09:39:01 -0500 Subject: Disabling static directory listing (#4919) --- web/web.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'web/web.go') diff --git a/web/web.go b/web/web.go index 228a1219a..d1a181d73 100644 --- a/web/web.go +++ b/web/web.go @@ -37,6 +37,10 @@ func InitWeb() { func staticHandler(handler http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Cache-Control", "max-age=31556926, public") + if strings.HasSuffix(r.URL.Path, "/") { + http.NotFound(w, r) + return + } handler.ServeHTTP(w, r) }) } -- cgit v1.2.3-1-g7c22