Skip to content

Commit

Permalink
fix: gateway cors is not applied
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaiba authored and brennanjl committed Feb 26, 2024
1 parent da2d0fb commit d36980d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/grpc/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ func NewGateway(ctx context.Context, httpAddress string, opts ...GatewayOpt) (*G
opt(gw)
}

for _, m := range gw.middlewares {
gw.logger.Info("apply middleware", zap.String("name", m.Name))
gw.Handler = m.Middleware(gw.Handler)
}

grpcDialOpts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}
for _, grpcService := range gw.grpcServices {
if err := grpcService.connector(ctx, mux, grpcService.endpoint, grpcDialOpts); err != nil {
Expand All @@ -76,7 +81,7 @@ func (g *GatewayServer) Shutdown(ctx context.Context) error {
}

func (g *GatewayServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
g.mux.ServeHTTP(w, r)
g.ServeHTTP(w, r)
}

func (g *GatewayServer) SetupHTTPSvc(ctx context.Context) error {
Expand Down

0 comments on commit d36980d

Please sign in to comment.