@@ -1111,9 +1111,17 @@ func (p *OAuthProxy) addHeadersForProxying(rw http.ResponseWriter, req *http.Req
11111111func isAjax(req *http.Request) bool {
11121112 acceptValues := req.Header.Values("Accept")
11131113 const ajaxReq = applicationJSON
1114− for _, v := range acceptValues {
1115− if v == ajaxReq {
1116− return true
1114+ // Iterate over multiple Accept headers, i.e.
1115+ // Accept: application/json
1116+ // Accept: text/plain
1117+ for _, mimeTypes := range acceptValues {
1118+ // Iterate over multiple mimetypes in a single header, i.e.
1119+ // Accept: application/json, text/plain, */*
1120+ for _, mimeType := range strings.Split(mimeTypes, ",") {
1121+ mimeType = strings.TrimSpace(mimeType)
1122+ if mimeType == ajaxReq {
1123+ return true
1124+ }
11171125 }
11181126 }
11191127 return false