grpc / grpc-web

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

What are the risks of using grpc-web with nginx? #1218

Closed zakhio closed 1 year ago

zakhio commented 2 years ago

Hello @stanley-cheung, @sampajano

Thanks a lot your contributions to grpc-web.

I have a question what are the risks of using grpc-web with nginx? Also I noticed that example of nginx for grpc-web was added on 21 Oct 2019 and then removed on 15 Mar 2021. What was the reasoning behind it?

Envoy is out of the scope as it is not part of default ingress configuration in Kubernetes and it has complex configuration schema.

Thanks in advance, Andrey

sampajano commented 2 years ago

Thanks Andrey :)

I'm not sure about all the history behind the decision, but Envoy is now the recommended proxy with official grpc-web support.

Maybe others would know more. :)

zakhio commented 2 years ago

Who can I ask about this decision?

idc77 commented 2 years ago

I don't remember it correctly. When I started there was a custom nginx module to support grpc to grpc-web. This was made away with. Something about appended frames or something not working with nginx and http/2. It does seem like they're agenda pushing with envoy. No one would use envoy if not for grpc-web. When I found out nginx couldn't be used I abandoned grpc and went back to RESTful. That was about 4 years ago. Lately I've been trying to check the status of grpc and grpc-web. Some people claim it's working with nginx out of the box, but I'm sceptical. Also other concerns like efficiency and base64-encoded communication (why use protobuf when you're sending b64 payload) require an update.

I doubt you'll receive an answer. Their roadmap is not updated and they're hell bent on pushing their pet project envoy down everyone's throat despite nginx being established everywhere.

sampajano commented 2 years ago

@zakhio I've tried asking but sorry have not received definitive answers :)

===

@idc77 your frustration is understood.. and sorry that you feel that way. But please avoid using derogatory terms to help maintain a respectful discussion atmosphere. thanks :)

fedej commented 2 years ago

Not sure what the risks are but I have setup nginx to proxy grpc-web requests using its JS module and a little configuration for a toy project of mine.

This is a minimal example that uses both a web client and a python client to make the calls through nginx.

jmzwcn commented 1 year ago

Nginx is supported out of box, the config is very simple!

https://github.com/emart-io/cross/blob/main/pwa/nginx.conf

sampajano commented 1 year ago

@jmzwcn Thanks for the pointer! It does seem that way..

See https://github.com/grpc/grpc-web/discussions/1322 where I linked some pointers on nginx support.

I'll close the bug for now since official nginx seems to exist (API, announcement).

Thanks!