Invalid middleware configuration, invalid middleware type or middleware does not exist

Hi all, I get the following error in traefik when I try to use the geoblock middleware

image

my docker-compose file under commands adds the plugin correctly

image

and the geoblock rules are correct

image

and in my app (nextcloud) under labels I add the correct middleware

any ideas on what goes wrong?

How do you load the geoblock config?

I have them as yml files in a rules directory. And the I have the file watch to be true

image

Share your full Traefik static and dynamic config, and docker-compose.yml if used.

Use 3 backticks before and after code/config to make it readable. In yaml every space matters.

below you can see the docker compose file. As for the rest of the files I do not use any, I have everything in the compose file. For the geoblock I have a file in rules directory, which is included in the first post of the question. Let me know if you need any extra info.

version: '3'

services:
  traefik:
    image: traefik:2.11.0
    restart: unless-stopped
    read_only: true
    mem_limit: 2G
    cpus: 0.75
    depends_on:
      dockerproxy:
        condition: service_healthy
    security_opt:
      - no-new-privileges:true
    volumes:
      - $DOCKERDIR/rules:/rules
      - $DOCKERDIR/acme/acme.json:/acme.json
      - $DOCKERDIR/logs:/logs
      - $DOCKERDIR/plugins:/plugins
    command:
      - --global.checkNewVersion=true
      - --global.sendAnonymousUsage=true
      - --entryPoints.http.address=:80
      - --entryPoints.https.address=:443
      - --entryPoints.traefik.address=:8080
      - --entrypoints.https.forwardedHeaders.trustedIPs=$CLOUDFLARE_IPS,$LOCAL_IPS
      - --log=true
      - --log.filePath=/logs/traefik.log
      - --log.level=DEBUG
      - --accessLog=true
      - --accessLog.filePath=/logs/access.log
      - --accessLog.bufferingSize=100
      - --accessLog.filters.statusCodes=204-299,400-499,500-599
      # Providers
      - --providers.docker=true
      - --providers.docker.watch=true
      - --providers.docker.endpoint=tcp://dockerproxy:2375
      - --providers.docker.exposedByDefault=false
      - --providers.docker.network=traefik-servicenet
      - --providers.docker.swarmMode=false
      - --providers.file.directory=/rules
      - --providers.file.watch=true 

      # Dashboard
      - --api=true
      - --api.insecure=true
      - --api.dashboard=true

      # TLS
      - --entrypoints.https.http.tls.options=tls-opts@file
      - --entrypoints.https.http.tls.certresolver=dns-cloudflare
      - --entrypoints.https.http.tls.domains[0].main=$DOMAINNAME_CLOUD_SERVER
      - --entrypoints.https.http.tls.domains[0].sans=*.$DOMAINNAME_CLOUD_SERVER
      - --certificatesResolvers.dns-cloudflare.acme.caServer=https://acme-staging-v02.api.letsencrypt.org/directory
      - --certificatesResolvers.dns-cloudflare.acme.email=$CLOUDFLARE_EMAIL
      - --certificatesResolvers.dns-cloudflare.acme.storage=/acme.json
      - --certificatesResolvers.dns-cloudflare.acme.dnsChallenge.provider=cloudflare
      - --certificatesResolvers.dns-cloudflare.acme.dnsChallenge.resolvers=1.1.1.1:53,1.0.0.1:53
      - --certificatesResolvers.dns-cloudflare.acme.dnsChallenge.delayBeforeCheck=90
      # Metrics
      - --metrics.prometheus=true
      - --metrics.prometheus.buckets=0.100000, 0.300000, 1.200000, 5.000000
      # Plugins
      - --experimental.plugins.enabled=true
      - --experimental.plugins.fail2ban.modulename=github.com/tomMoulard/fail2ban
      - --experimental.plugins.fail2ban.version=v0.7.1
      - --experimental.plugins.geoblock.modulename=github.com/PascalMinder/geoblock
      - --experimental.plugins.geoblock.version=v0.2.8
    labels:
      - "traefik.enable=true"
    environment:
      - CF_API_EMAIL=$CLOUDFLARE_EMAIL
      - CF_API_KEY=$CLOUDFLARE_API_KEY
      - DOMAINNAME_CLOUD_SERVER
    networks:
      docker-proxynet:
        ipv4_address: 172.250.0.3
      traefik-servicenet:
        ipv4_address: 192.168.64.2
      
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"

networks:
  traefik-servicenet:
    external: true
    name: traefik-servicenet
  docker-proxynet:
    name: docker-proxynet
    driver: bridge
    ipam:
      config:
        - subnet: "172.250.0.0/24"

I most definitely do not pretend to know the solution, but perhaps enable logging (see documentation) and then follow the logs to see whether the plugins are loaded correctly.

Logging should be set to the least ERROR or DEBUG to view plugin status and related errors.
I'm having a similar issue with the crowdsec middleware plugin. It turns out even when only defining the plugin in the static traefik config, it throws an error when downloading and configuring the plugin.
That needs to be resolved before you can even hope to use the middleware in the rest of your set-up.