Skip to main content
Traefik is a modern HTTP reverse proxy with automatic service discovery. This guide shows how to deploy Anubis with Traefik using Docker labels or Kubernetes.

Deployment Architecture

Traefik uses Anubis as a ForwardAuth middleware:

Docker Compose Configuration

Here’s a complete working example with Traefik v3.3: compose.yml:
traefik.yml:

How It Works

  1. User requests https://example.com
  2. Traefik checks middleware - ForwardAuth sends request to http://anubis:8080/.within.website/x/cmd/anubis/api/check
  3. Anubis validates:
    • If validated: Returns 200, Traefik forwards to backend
    • If not validated: Returns 401 with redirect to challenge page
  4. User completes challenge at https://anubis.example.com
  5. Anubis redirects back to https://example.com
  6. Request succeeds - cookie is set, future requests pass validation

ForwardAuth Middleware

The key configuration is the ForwardAuth middleware:
This tells Traefik to send an auth check to Anubis before forwarding to the backend.

Additional ForwardAuth Options

Multiple Protected Services

Protect different services with the same Anubis instance:
Update Anubis environment:

Path-Based Protection

Protect only specific paths:
Note: Higher priority rules are evaluated first.

Kubernetes Deployment

For Kubernetes with Traefik ingress controller, see the Kubernetes deployment guide. Quick example using Ingress:

Custom Middleware Chain

Combine Anubis with other Traefik middlewares:
Middleware execution order: rate-limit → anubis → compression

Health Checks

Configure Traefik to health check Anubis:

Load Balancing Multiple Anubis Instances

All instances must use the same signing key for JWT validation.

Troubleshooting

Redirect Loops

Check:
  1. REDIRECT_DOMAINS includes all your domains
  2. PUBLIC_URL matches Anubis router hostname
  3. COOKIE_DOMAIN is set correctly

502 Bad Gateway on Auth Request

Verify:
  1. Anubis is running: docker ps
  2. Network connectivity: docker exec traefik wget -O- http://anubis:8080/.within.website/x/cmd/anubis/api/check
  3. Check Traefik logs: docker logs traefik

Certificates Not Working

Ensure:
  1. DNS points to your server
  2. Ports 80 and 443 are accessible
  3. Email is configured in traefik.yml
  4. Check Let’s Encrypt rate limits

ForwardAuth Not Triggering

Verify:
  1. Middleware is attached to router: middlewares=anubis@docker
  2. Middleware name matches: traefik.http.middlewares.anubis.forwardauth.address=...
  3. Check Traefik dashboard for middleware configuration

Testing

Test the ForwardAuth flow:

Resources