From e5f2b623dc8dadb0ac65b75237a9201a8b3830f0 Mon Sep 17 00:00:00 2001 From: Benjamin Perez Date: Tue, 7 Sep 2021 18:19:51 -0500 Subject: [PATCH] Applied workaround for MIME issue on windows --- restapi/configure_console.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/restapi/configure_console.go b/restapi/configure_console.go index 665fd4b2b0..3d5ab971c8 100644 --- a/restapi/configure_console.go +++ b/restapi/configure_console.go @@ -240,6 +240,11 @@ var reHrefIndex = regexp.MustCompile(`(?m)((href|src)="(.\/).*?")`) // wrapHandlerSinglePageApplication handles a http.FileServer returning a 404 and overrides it with index.html func wrapHandlerSinglePageApplication(h http.Handler) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { + // This is used to enforce application/javascript MIME on Windows (https://github.com/golang/go/issues/32350) + if strings.HasSuffix(r.URL.Path, ".js") { + w.Header().Set("Content-Type", "application/javascript") + } + nfrw := ¬FoundRedirectRespWr{ResponseWriter: w} h.ServeHTTP(nfrw, r) if nfrw.status == 404 || r.URL.String() == "/" {