authorize: do not send redirects to gRPC (#2314)

This commit is contained in:
wasaga 2021-07-06 10:24:33 -04:00 committed by GitHub
parent 448286ffbc
commit 7d0db7d8ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -192,6 +192,10 @@ func shouldRedirect(in *envoy_service_auth_v3.CheckRequest) bool {
return true
}
if strings.HasPrefix(requestHeaders["content-type"], "application/grpc") {
return false
}
a, err := rfc7231.ParseAccept(requestHeaders["accept"])
if err != nil {
return true
@ -203,6 +207,7 @@ func shouldRedirect(in *envoy_service_auth_v3.CheckRequest) bool {
"text/plain",
"application/grpc-web-text",
"application/grpc-web+proto",
"application/grpc+proto",
})
if !ok {
return true