From d85af6ad9f3611479638461d1c9d0b94775e2879 Mon Sep 17 00:00:00 2001 From: Livio Spring Date: Fri, 12 Jul 2024 11:54:02 +0200 Subject: [PATCH] fix: correctly differ between grpc and grpc-web (#8292) # Which Problems Are Solved While #8285 also checked for `+proto` and `+json` grpc content types, it accidentally matched all grpc-web requests to grpc. # How the Problems Are Solved - fixed the regex by checking for an exact match (added start `^` and end `$` anchors) # Additional Changes None # Additional Context - relates to #8285 (cherry picked from commit d7c0ec282ae34773d682e60f79bc9723e8f4c9ec) --- internal/api/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/api/api.go b/internal/api/api.go index 6695403e46..f3ed27c2b0 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -180,7 +180,7 @@ func (a *API) RouteGRPC() { Name("grpc") http2Route. Methods(http.MethodPost). - HeadersRegexp(http_util.ContentType, `application\/grpc(\+proto|\+json)?`). + HeadersRegexp(http_util.ContentType, `^application\/grpc(\+proto|\+json)?$`). Handler(a.grpcServer) a.routeGRPCWeb()