Update url prefixer to ignore svgs

Co-authored-by: Brandon Farmer <bthesorceror@gmail.com>
pull/10616/head
Iris Scholten 2018-05-08 13:55:24 -07:00
parent 317a7cbf59
commit 675b9a2625
1 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@ import (
"bytes"
"io"
"net/http"
"regexp"
"github.com/influxdata/chronograf"
)
@ -83,6 +84,12 @@ func (up *URLPrefixer) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
return
}
isSVG, _ := regexp.Match(".svg$", []byte(r.URL.String()))
if isSVG {
up.Next.ServeHTTP(rw, r)
return
}
// chunked transfer because we're modifying the response on the fly, so we
// won't know the final content-length
rw.Header().Set("Connection", "Keep-Alive")