I'm using Traefil 3.3.5 in Docker environment with docker provider.
I've been strugling trying to enable IpAllowList for all HTTP requests to all my docker containers.
Can you please help me?
Thanks for your fast answer!
Yes, I've read all documentation, and I intend to use the middleware attached to the entrypoint.
For example:
entryPoints:
web:
address: :80
http:
middlewares:
- alfa-allowlist@file
forwardedHeaders:
trustedIPs:
- "192.168.1.1/32"
And I have created in /etc/traefik/middlewares/alfa-allowlist.yml with content
http:
middlewares:
alfa-allowlist:
ipAllowList:
sourceRange:
- "127.0.0.1/32"
- "192.168.1.0/24"
ipstrategy:
excludedips:
- "127.0.0.1/32"
- "192.168.1.1/32"
But I always get the error:
error="middleware \"alfa-allowlist@file\" does not exist" entryPointName=web
Thanks! I believe I've found the solution - documenting here so anyone strugling with this error in future could easily solve it.
I was expecting that configuration files would be automatically loaded from the "/etc/traefik/middlewares" folder (I'm not sure where I got the idea from).
Fact is, I've to tell Traefik from where to load additional configuration files.
First, I've added a dynamic file provider as:
providers:
file:
directory: /etc/traefik/dynamic
watch: true
Then, I've add the file alfa-allowlist.yml to the dynamic folder.
After that (and also carefully reviewing the name of the files, etc), then my middleware has been recognized, and I has been attached to the entryPoint.
It's now working as expected.
Thanks!!!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.