outposts/proxy: use disableIndex for static files

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-11-19 10:50:56 +01:00
parent 2ac9f5426d
commit d1bd8f333b
3 changed files with 6 additions and 5 deletions

View File

@ -0,0 +1,17 @@
package web
import (
"net/http"
"strings"
)
func DisableIndex(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if strings.HasSuffix(r.URL.Path, "/") {
http.NotFound(w, r)
return
}
next.ServeHTTP(w, r)
})
}