mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-01 00:37:24 +00:00
fix: header matcher of grpc-web route (#3524)
This commit is contained in:
parent
fa9f581d56
commit
9ffd83af7d
@ -98,7 +98,13 @@ func (a *API) routeGRPC() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *API) routeGRPCWeb(router *mux.Router) {
|
func (a *API) routeGRPCWeb(router *mux.Router) {
|
||||||
router.NewRoute().HeadersRegexp("Content-Type", "application/grpc-web.*").Handler(
|
router.NewRoute().MatcherFunc(
|
||||||
|
func(r *http.Request, _ *mux.RouteMatch) bool {
|
||||||
|
if strings.Contains(r.Header.Get("content-type"), "application/grpc-web+") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return strings.Contains(r.Header.Get("access-control-request-headers"), "x-grpc-web")
|
||||||
|
}).Handler(
|
||||||
grpcweb.WrapServer(a.grpcServer,
|
grpcweb.WrapServer(a.grpcServer,
|
||||||
grpcweb.WithAllowedRequestHeaders(
|
grpcweb.WithAllowedRequestHeaders(
|
||||||
[]string{
|
[]string{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user