I installed this plugin and I configured it like instructions says. I have a traefik.yml
file where I setup the experimental option and added the plugin
option along docker
and file
:
experimental:
plugins:
traefik_dynamic_public_whitelist:
moduleName: "github.com/Shoggomo/traefik_dynamic_public_whitelist"
version: "v0.1.5"
entryPoints:
http:
address: ":80"
https:
address: ":443"
forwardedHeaders:
trustedIPs:
- 173.245.48.0/20
- 103.21.244.0/22
- 103.22.200.0/22
- 103.31.4.0/22
- 141.101.64.0/18
- 108.162.192.0/18
- 190.93.240.0/20
- 188.114.96.0/20
- 197.234.240.0/22
- 198.41.128.0/17
- 162.158.0.0/15
- 104.16.0.0/13
- 104.24.0.0/14
- 172.64.0.0/13
- 131.0.72.0/22
providers:
docker:
watch: true
exposedByDefault: false
network: traefik
file:
directory: /configs
watch: true
plugin:
traefik_dynamic_public_whitelist:
pollInterval: "300s" # optional, default is "300s"
ipv4Resolver: "https://api4.ipify.org/?format=text" # optional, default is "https://api4.ipify.org?format=text" (needs to provide only the public ip on request) # optional, additional source ranges, that should be accepted
ipStrategy: # optional, see https://doc.traefik.io/traefik/middlewares/http/ipwhitelist/#configuration-options for more info
excludedIPs:
- 173.245.48.0/20
- 103.21.244.0/22
- 103.22.200.0/22
- 103.31.4.0/22
- 141.101.64.0/18
- 108.162.192.0/18
- 190.93.240.0/20
- 188.114.96.0/20
- 197.234.240.0/22
- 198.41.128.0/17
- 162.158.0.0/15
- 104.16.0.0/13
- 104.24.0.0/14
- 172.64.0.0/13
- 131.0.72.0/22
log:
level: ERROR
Then I have a config for traefik itself:
http:
routers:
api:
rule: "Host(`traefik.example.com`)"
entrypoints:
- https
middlewares:
- public_ipwhitelist@plugin-traefik_dynamic_public_whitelist
- middlewares-basic-auth@file
service: "api@internal"
When I run traefik I get:
time="2024-02-09T11:29:16+01:00" level=error msg="middleware \"public_ipwhitelist@plugin-traefik_dynamic_public_whitelist\" does not exist" entryPointName=https routerName=api@file
time="2024-02-09T11:29:15+01:00" level=info msg="Configuration loaded from file: /traefik.yml"
I tried a lot of combinations but at the end, it just works. Yes, plugin is working, loaded and everything is fine:
I am not sure if this is a bug or a race condition in the configuration but here I am