This plugin is an attempt to implement converter of HTTP protocol to gRPC as a middleware plugin for Traefik. It is useful when you declare router to gRPC backend for gRPC client, and additionally you want to intercept connection with middleware, that do HTTP request to third party services and forward it back to gRPC client. Forward Auth for example.
For development, was used following gRPC specs:
bodyAsStatusMessage
: if true, middleware try set body (as utf8 string) to grpc status message,
if false, grpc status message will be empty. Default is falselogLevel
: info
or debug
. Default is info
--experimental.localplugins.http2grpc=true
--experimental.localplugins.http2grpc.modulename=github.com/v-electrolux/http2grpc
TRAEFIK_EXPERIMENTAL_LOCALPLUGINS_http2grpc=true
TRAEFIK_EXPERIMENTAL_LOCALPLUGINS_http2grpc_MODULENAME=github.com/v-electrolux/http2grpc
experimental:localplugins:http2grpc:modulename: github.com/v-electrolux/http2grpc
[experimental.localplugins.http2grpc]modulename = "github.com/v-electrolux/http2grpc"
traefik.http.middlewares.checkAuth.basicauth.users=test:$$apr1$$H6uskkkW$$IgXLP6ewTrSuBkTrqE8wj/
traefik.http.middlewares.http2grpcMiddleware.plugin.http2grpc.bodyAsStatusMessage=true
traefik.http.middlewares.http2grpcMiddleware.plugin.http2grpc.logLevel=info
traefik.http.routers.http2grpcRouter.middlewares=http2grpcMiddleware,checkAuth
http:routers:http2grpcRouter:rule: host(`demo.localhost`)service: grpcBackendentryPoints:- webmiddlewares:- http2grpcMiddleware- someForwardAuthMiddlewareservices:grpcBackend:loadBalancer:servers:- url: 127.0.0.1:5000middlewares:http2grpcMiddleware:plugin:http2grpc:bodyAsStatusMessage: truelogLevel: infocheckAuth:basicauth:users:- "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/"