How to use forwardAuth with internal service in Traefik?

1k Views Asked by At

Traefik allows to specify a middleware to authenticate each request using forwardAuth, in the documentation it specifies to use an external provider.

# Forward authentication to example.com
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: test-auth
spec:
  forwardAuth:
    address: https://example.com/auth  

I have an auth server running inside my k8 cluster itself which I want to use instead on an external service, is there a way to use forwardAuth to point to internal service?

1

There are 1 best solutions below

0
On BEST ANSWER

I used K8 Fully Qualified Domain Name as the address for this to work:

service-name.namespace.svc.cluster.local.