edge-router:
image: traefik
# further configuration
labels:
- traefik.http.middlewares.heimdall.forwardauth.address=http://heimdall:4456
- traefik.http.middlewares.heimdall.forwardauth.authResponseHeaders=X-Id-Token,Authorization
# further labels
service:
image: my-service
# further configuration
labels:
- traefik.http.routers.service.middlewares=heimdall
# further labelsTraefik Proxy Integration
Traefik Proxy is a modern HTTP proxy and load balancer for microservices, heimdall can be integrated with via the ForwardAuth Middleware by making use of the Decision API. In such setup, traefik delegates authentication and authorization to heimdall. If heimdall answers with a 2XX code, traefik grants access and forwards the original request to the upstream service. Otherwise, the response from heimdall is returned to the client.
To achieve this,
Configure traefik
to make use of the aforesaid ForwardAuth middleware by setting the
addressproperty to the decision service endpoint andconfigure the
authResponseHeadersto contain the required header name(s), heimdall sets in the HTTP responses (depends on your Hydrators and Mutators configuration).Configure the route of your service to make use of this middleware.
Traefik makes use of |
Last updated on Aug 26, 2022