GitHub issue ipwhitelistshaper #6, opened by
Sandarr95on GitHub
Not sure if this use-case is supported, but I’m trying to use the middleware in multiple routers, and it seems the whitelistedIPs are not shared across routers. I think I have the behavior narrowed down, but I don’t know what the intended operating mode is.
After adding log lines, right before the check on isWhitelisted:
fmt.Printf("[%s] INFO whitelistedIPs %+v\n", i.name, i.whitelistedIPs)
fmt.Printf("[%s] INFO clientIP (%s), isWhitelisted: (%t), expiresAt: (%s).\n", i.name, clientIP, isWhitelisted, ipData.ExpiresAt)
And running these requests after approval of knock.localhost has happened:
curl -6 knock.localhost #=> 418 (default of noop@internal)
curl -6 service.localhost #=> 403
I can see this in logging:
[my-ipwhitelistshaper@file] INFO whitelistedIPs map[127.0.0.1:{ExpiresAt:2025-10-22 21:48:26.421020933 +0200 CEST ValidationID:8a35d8fa02016749091fbc7411435eda ValidationCode:penguin} ::1:{ExpiresAt:2025-10-22 21:49:40.142884351 +0200 CEST m=+402.508945046 ValidationID:3948f3f1798c7aed9569733a6342a889 ValidationCode:airplane}]
[my-ipwhitelistshaper@file] INFO clientIP (::1), isWhitelisted: (true), expiresAt: (2025-10-22 21:49:40.142884351 +0200 CEST m=+402.508945046)
...
[my-ipwhitelistshaper@file] INFO whitelistedIPs map[]
[my-ipwhitelistshaper@file] INFO clientIP (::1), isWhitelisted: (false), expiresAt: (0001-01-01 00:00:00 +0000 UTC)
Running traefik with this config:
# Static configuration
log:
level: DEBUG
providers: …
---
💬 Discuss it here. Status, fixes and code review stay on [GitHub](https://github.com/hhftechnology/ipwhitelistshaper/issues/6).
<!-- hhf-forum-sync -->