https://github.com/mholt/caddy-grpc-web
Caddy module to Convert gRPC-Web requests to normal gRPC for servers
https://github.com/mholt/caddy-grpc-web
envoy-filter grpc grpc-json grpc-server grpc-web
Last synced: about 1 year ago
JSON representation
Caddy module to Convert gRPC-Web requests to normal gRPC for servers
- Host: GitHub
- URL: https://github.com/mholt/caddy-grpc-web
- Owner: mholt
- License: mit
- Created: 2022-07-30T18:49:14.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-21T21:51:05.000Z (over 2 years ago)
- Last Synced: 2025-03-22T14:04:59.259Z (about 1 year ago)
- Topics: envoy-filter, grpc, grpc-json, grpc-server, grpc-web
- Language: Go
- Homepage:
- Size: 118 KB
- Stars: 27
- Watchers: 5
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
gRPC-Web Bridge for Caddy
=========================
This module implements a bridge from gRPC-Web clients to gRPC servers. It is similar to Envoy's `envoy.filters.http.grpc_web` filter. **It is EXPERIMENTAL and subject to change.**
> [!NOTE]
> This is not an official repository of the [Caddy Web Server](https://github.com/caddyserver) organization.
To convert gRPC-Web requests to gRPC, simply add the `grpc_web` handler to your HTTP route. It should go before your `reverse_proxy` or any other handler that would expect a gRPC request.
## Installation
A new Caddy server with this module needs to be built to support GRPC-web calls. Build it with:
```
docker build -t /caddy-grpc .
```
## Example
Caddyfile:
```
{
order grpc_web before reverse_proxy
}
:5452 {
grpc_web
reverse_proxy h2c://127.0.0.1:50051
}
```
JSON:
```json
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":5452"
],
"routes": [
{
"handle": [
{
"handler": "grpc_web"
},
{
"handler": "reverse_proxy",
"transport": {
"protocol": "http",
"versions": [
"h2c",
"2"
]
},
"upstreams": [
{
"dial": "127.0.0.1:50051"
}
]
}
]
}
]
}
}
}
}
}
```
You can also specify the `websocket_ping` parameter to an interval value >= 1s for websocket keep-alive pings to be enabled.