From 90cadc76bbc7c71198b7f1f244f85b5890efc63e Mon Sep 17 00:00:00 2001 From: Alex <33497058+bexsoft@users.noreply.github.com> Date: Tue, 7 Sep 2021 19:57:00 -0500 Subject: [PATCH] Applied workaround for MIME issue on windows (#1014) --- restapi/configure_console.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/restapi/configure_console.go b/restapi/configure_console.go index 665fd4b2b..3d5ab971c 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() == "/" {