Skip to content

Compatibility with traefik-foward-auth?  #124

@kvangent

Description

@kvangent

I'm trying to configure this plugin with https://github.com/thomseddon/traefik-forward-auth.

I'm running traefik-forward-auth as a Service with a middleware as such:

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: traefik-forward-auth
spec:
  forwardAuth:
    address: http://traefik-forward-auth.default.svc.cluster.local:4181
    authResponseHeaders:
      - X-Forwarded-User

Then I tried to apply a middleware for fail2ban:

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: fail2ban
  namespace: traefik
spec:
  plugin:
    fail2ban:
      logLevel: DEBUG
      rules:
        bantime: "5m"
        findtime: "10m"
        maxretry: 3
        enabled: true
        statuscode: "400-499"

Everything starts up fine, but testing with 10x requests that return 401 all successfully connect without an IP ban. I tried reversing the order of middleware (putting fail2ban first and traefik-forward-auth) and started to get the following error (from the first request):

2024-06-07T03:02:15Z DBG github.com/traefik/traefik/v3/pkg/middlewares/auth/forward.go:180 > Remote error http://traefik-forward-auth.default.svc.cluster.local:4181. StatusCode: 307 middlewareName=default-traefik-forward-auth@kubernetescrd middlewareType=ForwardAuth
2024-06-07T03:02:15Z DBG log/log.go:245 > http: superfluous response.WriteHeader call from github.com/traefik/traefik/v3/pkg/middlewares/capture.(*captureResponseWriter).WriteHeader (capture.go:169)

I'm unsure of what's exactly is causing this, and would appreciate any tips.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions