I'm new to Traefik.
I just implemented Traefik ForwardAuth
with my simple auth server.
It seems that Traefik ForwardAuth
can only manage the service, but can't manage APIs in service.
To give an example:
There's a service SVC with 3 APIs that are: testAPI_1
, testAPI_2
, testAPI_3
.
Traefik ForwardAuth
can only control who can visit service SVC, but can't control who should visit testAPI_1
and who shouldn't visit testAPI_2
.
Can Traefik manage API's authorization/authentication?
Here's my service's setting in docker-compose.yml
:
whoami:
# A container that exposes an API to show its IP address
image: containous/whoami
networks:
- my-net
labels:
# set middleware
- "traefik.http.middlewares.test-auth.forwardauth.address=http://auth-server/whoami"
- "traefik.http.middlewares.test-auth.forwardauth.trustForwardHeader=true"
- "traefik.http.middlewares.test-auth.forwardauth.authResponseHeaders=X-Client-ID"
- "traefik.http.routers.whoami.middlewares=test-auth@docker"
- "traefik.http.routers.whoami.rule=Path(`/whoami`)"
Any help you can provide is greatly appreciated!