Version: 2.4.0
gRPC Proxy
proxying gRPC traffic: gRPC client -> APISIX -> gRPC/gRPCS server
Parameters#
scheme: theschemeof the route's upstream must begrpcorgrpcs.uri: format likes /service/method, Example:/helloworld.Greeter/SayHello
Example#
create proxying gRPC route#
Here's an example, to proxying gRPC service by specified route:
- attention: the
schemeof the route's upstream must begrpcorgrpcs. - attention: APISIX use TLS‑encrypted HTTP/2 to expose gRPC service, so need to config SSL certificate
- attention: APISIX also support to expose gRPC service with plaintext HTTP/2, which does not rely on TLS, usually used to proxy gRPC service in intranet environment
- the grpc server example:grpc_server_example
testing HTTP/2 with TLS‑encrypted#
Invoking the route created before:
This means that the proxying is working.
testing HTTP/2 with plaintext#
By default, the APISIX only listens to 9443 for TLS‑encrypted HTTP/2. You can support HTTP/2 with plaintext via the node_listen section under apisix in conf/config.yaml:
Invoking the route created before:
This means that the proxying is working.
gRPCS#
If your gRPC service encrypts with TLS by itself (so called gPRCS, gPRC + TLS), you need to change the scheme to grpcs. The example above runs gRPCS service on port 50052, to proxy gRPC request, we need to use the configuration below: