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

@ -31,7 +31,7 @@ func (ps *ProxyServer) HandlePing(rw http.ResponseWriter, r *http.Request) {
func (ps *ProxyServer) HandleStatic(rw http.ResponseWriter, r *http.Request) {
staticFs := http.FileServer(http.FS(staticWeb.StaticDist))
before := time.Now()
http.StripPrefix("/akprox/static", staticFs).ServeHTTP(rw, r)
web.DisableIndex(http.StripPrefix("/akprox/static", staticFs)).ServeHTTP(rw, r)
after := time.Since(before)
metrics.Requests.With(prometheus.Labels{
"outpost_name": ps.akAPI.Outpost.Name,
@ -54,7 +54,7 @@ func (ps *ProxyServer) Handle(rw http.ResponseWriter, r *http.Request) {
if !ok {
// If we only have one handler, host name switching doesn't matter
if len(ps.apps) == 1 {
ps.log.WithField("host", host).Warning("passing to single app mux")
ps.log.WithField("host", host).Trace("passing to single app mux")
for k := range ps.apps {
ps.apps[k].ServeHTTP(rw, r)
return