From 7245340e88ee7118660c806dcd40cfca99f55782 Mon Sep 17 00:00:00 2001 From: Julio H Morimoto Date: Thu, 25 Apr 2019 14:53:22 -0300 Subject: [PATCH] Fix default Content-Type for custom-error-pages example This should fix issue [4039](https://github.com/kubernetes/ingress-nginx/issues/4039). This default backend fails to send the correct `Content-Type` header when it fails to decode the `Accept` request header. This patch simply forces `text/html` in that specific scenario. --- images/custom-error-pages/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/images/custom-error-pages/main.go b/images/custom-error-pages/main.go index f6baac558..7e3f683b1 100644 --- a/images/custom-error-pages/main.go +++ b/images/custom-error-pages/main.go @@ -106,6 +106,7 @@ func errorHandler(path string) func(http.ResponseWriter, *http.Request) { cext, err := mime.ExtensionsByType(format) if err != nil { log.Printf("unexpected error reading media type extension: %v. Using %v", err, ext) + format = "text/html" } else if len(cext) == 0 { log.Printf("couldn't get media type extension. Using %v", ext) } else {