grpc_web
Transcodes gRPC-Web requests on a grpc_pass location to and from real gRPC.
| Syntax | grpc_web on | off; |
|---|---|
| Contexts | httpserverlocation |
| Default | grpc_web off; |
Behavior
xin-native: nginx has no gRPC-Web module. Valid only on a location whose content handler is grpc_pass -- grpc_web on; anywhere else is refused at load, by name. A request whose content-type is not one of the four gRPC-Web types is forwarded untouched, so a native gRPC client and a browser client can share one location. The response status is always 200; the real gRPC status arrives in a trailer frame appended to the body. No CORS headers are synthesised.
Example
location /helloworld.Greeter/ {
grpc_pass grpc://127.0.0.1:50051;
grpc_web on;
}