Table of Contents generated with DocToc
gRPC Proxy
This is under experimental.
rk-boot will proxy request if not implemented with configuration in boot.yaml.
Example
Proxy server at 8080
There is no gRPC API defined. Proxy request to localhost:8081 if metadata has K/V as "domain:test".
---
grpc:
- name: greeter # Required
port: 8080 # Required
enabled: true # Required
proxy:
enabled: true
rules:
- type: headerBased
headerPairs: ["domain:test"]
dest: ["localhost:8081"]
# - type: pathBased
# paths: [""]
# dest: [""]
# - type: IpBased
# Ips: [""]
# dest: [""]
Test server at 8081
Enable common service in order to receive proxied request from 8080.
---
grpc:
- name: greeter # Required
port: 8081 # Required
enabled: true # Required
commonService:
enabled: true # Optional, default: false
gRPC client call port of 8080
Currently, proxy is only supported with gRPC client with codes.
grpc-gateway or grpcurl is not supported for proxying.
Run
go run proxy/main.go
go run test/main.go
go run client/main.go
2022-01-15T22:58:31.865+0800 INFO client/main.go:40 [Message]: message:"Hello !"