Skip to content

Commit

Permalink
Fix default Content-Type for custom-error-pages example
Browse files Browse the repository at this point in the history
This should fix issue [4039](kubernetes/ingress-nginx#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.
  • Loading branch information
Julio H Morimoto authored and brianredbeard committed Feb 8, 2020
1 parent 7474761 commit 432bbf4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions images/custom-error-pages/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 432bbf4

Please sign in to comment.