summaryrefslogtreecommitdiffstats
path: root/web/web.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-12-31 09:39:01 -0500
committerJoram Wilander <jwawilander@gmail.com>2016-12-31 09:39:01 -0500
commit267257b68055684f8bff94e4ae78d4b9e9c93b0b (patch)
treeecdc7fb5bfdbd6c638a7689e35d170f824562627 /web/web.go
parent2a91e5e031d9490f8364d55cb023d384d56f047f (diff)
downloadchat-267257b68055684f8bff94e4ae78d4b9e9c93b0b.tar.gz
chat-267257b68055684f8bff94e4ae78d4b9e9c93b0b.tar.bz2
chat-267257b68055684f8bff94e4ae78d4b9e9c93b0b.zip
Disabling static directory listing (#4919)
Diffstat (limited to 'web/web.go')
-rw-r--r--web/web.go4
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)
})
}