grpc plugin for Caddy Server
grpc
makes it possible for gRPC services to be consumed from browsers using the gRPC-Web protocol and normal gRPC
clients. (If the request is not a grpc-web
request, it will be served as a normal grpc
request)
The plugin is meant to serve the same purpose as grpcwebproxy by Improbable, but as a Caddy middleware plugin instead of a standalone Go application.
The plugin will be available to download as a plugin from Caddy's Download page.
Click on Add plugins
option and scroll down to the section where you can tick the http.grpc
box.
To verify the plugin is part of your downloaded instance of Caddy, run Caddy with the -plugins
command line flag:
caddy -plugins
http.grpc
should be listed under Other plugins
along with http
and any other plugins also included.
Note, because the plugin is still in development it's not yet available on the Caddy download page
- Inject Go gRPC Middleware into the underlying gRPC proxy using the Caddyfile.
- Load balancing features
example.com
grpc localhost:9090
The first line example.com
is the hostname/address of the site to serve.
The second line is a directive called grpc
where the backend gRPC service endpoint address (i.e localhost:9090
as in the example) can be specified.
(Note: The above configuration will default to having TLS 1.2 to the backend gRPC service)
grpc backend_addr {
backend_is_insecure
backend_tls_noverify
backend_tls_ca_files path_to_ca_file1 path_to_ca_file2
}
By default the proxy will connect to backend using TLS, however if the backend is serving in plaintext this option need to be added
By default the TLS to the backend will be verified, however if this is not the case then this option need to be added
Paths (comma separated) to PEM certificate chains used for verification of backend certificates. If empty, host CA chain will be used.
grpc.example.com
prometheus
log
grpc localhost:9090
This plugin is in BETA