fail2ban: Fail2ban Middleware does not recognise 200 status code

For some reason my setup does not recognize successful status codes and bans on the 11th request. I also don’t see anything in the logs even though I have enabled DEBUG logging. Setup:

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
    name: fail2ban
spec:
    plugin:
        fail2ban:
            logLevel: DEBUG
            rules:
                bantime: 30m
                enabled: "true"
                findtime: 10m
                maxretry: "10"
                statuscode: 400-499
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
    name: whoami-http
spec:
    entryPoints:
        - http
    routes:
        - match: Host(`redacted.com`) || Host(`www.redacted.com`)
          kind: Rule
          services:
              - name: whoami
                port: 80
          middlewares:
              - namespace: traefik
                name: fail2ban

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 10
  • Comments: 28 (9 by maintainers)

Most upvoted comments

Hi all, I’ve released a new version of this plugin : https://github.com/tomMoulard/fail2ban/releases/tag/v0.8.6

same issue here with traefik v3.3.3 and Fail2Ban v0.8.3, every request seems to count against the maxretry value regardless of status code

Have the same issue here with Fail2Ban v0.8.3 and Traefik v3.1.6

i use v0.8.6 as a local plugin, but i think it still is buggy - got banned when looking at my immich feed with hundreds of http 200s…

Hi all, I’ve released a new version of this plugin : https://github.com/tomMoulard/fail2ban/releases/tag/v0.8.6

Attempting to load it “officially” I’m getting the following error:

2025-06-05T11:21:06Z ERR Plugins are disabled because an error has occurred. error="unable to set up plugins environment: unable to download plugin github.com/tomMoulard/fail2ban: failed to call service: Get \"https://plugins.traefik.io/public/download/github.com/tomMoulard/fail2ban/v0.8.6\": GET https://plugins.traefik.io/public/download/github.com/tomMoulard/fail2ban/v0.8.6 giving up after 4 attempt(s)" plugins=["GeoBlock","fail2ban"]

It seems the last version which can be loaded from plugins.traefik.io is 0.8.3…

I have the same problem, also want to upgrade, but the latest version is 0.8.3 …

You can load the plugin “locally”. It’s a bit of a hassle and, technically, it’s for developers, but the functionality is there.

This can likely be closed as #188 has now been merged.

Note that the plugin catalog for Traefik still lists 0.8.3 as the latest version, and this version can only be used “locally”… From what I can tell the Traefik catalogue checks plugin version availability every 30m and the latest release was yesterday, so it should have been updated by now. Since it hasn’t this suggests there might be something wrong with the latest release.