Disabling static directory listing (#4919)

Этот коммит содержится в:
Christopher Speller
2016-12-31 09:39:01 -05:00
коммит произвёл Joram Wilander
родитель 2a91e5e031
Коммит 267257b680

Просмотреть файл

@@ -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)
})
}