grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.65k stars 764 forks source link

Status Code 415 #656

Closed eSPiYa closed 5 years ago

eSPiYa commented 5 years ago

I'm still new in gRPC and Angular/Typescript development. Is Angular still not supported yet, that is why I'm receiving this or another matter?

I'm on Windows and the gRPC server is an ASP.NET Core 3.0 gRPC project running behind an Nginx proxy server with self-made certificate. I can connect using a .NET client by automatically accepting the unsigned certificate.

I generated the code using this command:

protoc --plugin=protoc-gen-grpc-web.exe --js_out=import_style=commonjs:./src/app/services --grpc-web_out=import_style=typescript,mode=grpcwebtext:./src/app/services --proto_path=..\My.gRpc.Project\Protos\ greet.proto

I even tried to swap the mode with 'grpcweb', but I still receive this error:

grpc-message: Content-Type 'application/grpc-web-text' is not supported.

Is this related to the unsigned SSL certificate or I'm just using the wrong content-type or the generated typescript files just don't work on Angular? Thanks!

stanley-cheung commented 5 years ago

Nginx does not support gRPC-Web out of the box. Envoy does (with enabling a filter in your envoy.conf). Please check the main README of the repo for more information.