diff options
author | Christopher Speller <crspeller@gmail.com> | 2016-12-31 09:39:01 -0500 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-12-31 09:39:01 -0500 |
commit | 267257b68055684f8bff94e4ae78d4b9e9c93b0b (patch) | |
tree | ecdc7fb5bfdbd6c638a7689e35d170f824562627 | |
parent | 2a91e5e031d9490f8364d55cb023d384d56f047f (diff) | |
download | chat-267257b68055684f8bff94e4ae78d4b9e9c93b0b.tar.gz chat-267257b68055684f8bff94e4ae78d4b9e9c93b0b.tar.bz2 chat-267257b68055684f8bff94e4ae78d4b9e9c93b0b.zip |
Disabling static directory listing (#4919)
-rw-r--r-- | web/web.go | 4 |
1 files changed, 4 insertions, 0 deletions
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) }) } |