From c99c4c51119c40f8751168cdaaf01be188913611 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Tue, 8 May 2018 13:55:24 -0700 Subject: [PATCH] Update url prefixer to ignore svgs Co-authored-by: Brandon Farmer --- server/url_prefixer.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/url_prefixer.go b/server/url_prefixer.go index 0a58436460..9d095fa121 100644 --- a/server/url_prefixer.go +++ b/server/url_prefixer.go @@ -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")