We implemented GRPC API using golang, and now need some mechanism to route requests on two different hosts (prod/stage). The problem is the routing rule must be depended on grpc metadata
, not the header. Actually we pass iOS version at metadata parameter. And as far as i know Nginx for example cannot do this. We have no k8s or something, just the simple API daemon listening on some port.
authConf := viper.GetStringMapString("auth")
creds, err := credentials.NewServerTLSFromFile(authConf["certfile"], authConf["keyfile"])
if err != nil {
panic(err)
}
lis, err := net.Listen("tcp", ":"+viper.GetString("port"))
if err != nil {
panic(err)
}