# Whitelisted IPs not shared across multiple routers (ipwhitelistshaper #6)

**URL:** <https://forum.hhf.technology/t/whitelisted-ips-not-shared-across-multiple-routers-ipwhitelistshaper-6/4587>\
**Category:** IP Whitelist Shaper\
**Tags:** issue\
**Created:** [October 22, 2025, 7:54pm UTC](https://forum.hhf.technology/t/whitelisted-ips-not-shared-across-multiple-routers-ipwhitelistshaper-6/4587 "2025-10-22T19:54:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://forum.hhf.technology/user_avatar/forum.hhf.technology/system/32/6437_2.png) [@system](https://forum.hhf.technology/u/system)\
**Post date:** [October 22, 2025, 7:54pm UTC](https://forum.hhf.technology/t/whitelisted-ips-not-shared-across-multiple-routers-ipwhitelistshaper-6/4587/1 "2025-10-22T19:54:14Z")

</div>

> 🐙 **GitHub issue [ipwhitelistshaper #6](https://github.com/hhftechnology/ipwhitelistshaper/issues/6)**, opened by **`Sandarr95`** on 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`:

```go
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:

```bash
curl -6 knock.localhost #=> 418 (default of noop@​internal)
curl -6 service.localhost #=> 403

```

I can see this in logging:

```auto
[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:

```yaml
# 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 -->
```

---

<div class="post-metadata">

**Author:** ![system](https://forum.hhf.technology/user_avatar/forum.hhf.technology/system/32/6437_2.png) [@system](https://forum.hhf.technology/u/system)\
**Post date:** [October 24, 2025, 11:16am UTC](https://forum.hhf.technology/t/whitelisted-ips-not-shared-across-multiple-routers-ipwhitelistshaper-6/4587/2 "2025-10-24T11:16:20Z")

</div>

**`Sandarr95`** [commented on GitHub](https://github.com/hhftechnology/ipwhitelistshaper/issues/6#issuecomment-3442582783):

> Using a setup more similar to the README also doesn’t work. It seems the approve-router isn’t seeing the pending approvals created by the knock-knock-router:
> 
> ```auto
> [my-ipwhitelistshaper@​file] DEBUG Saving state. Pending approvals to save: 1 entries
> ...
> [my-ipwhitelistshaper@​file] DEBUG State loaded from file plugins-storage/ipwhitelistshaper/state.json. Pending approvals map size: 0
> [my-ipwhitelistshaper@​file] DEBUG State loaded in handleApproveRequest for IP ::1. Current pending map size: 0. Content samples: map[]
> [my-ipwhitelistshaper@​file] ERROR No pending approval found in current state for IP: ::1 (Token: fddbd0e4ce94118dadbdda601d4a7e5f). Approval attempt failed. Pending map keys: []
> 
> ```
> 
> ```yaml
> http:
> middlewares:
> my-ipwhitelistshaper:
> plugin:
> ipwhitelistshaper:
> approvalURL: "https://knock.localhost"
> storagePath: "./plugins-storage/ipwhitelistshaper"
> routers:
> # Main router that applies the whitelist protection
> protected-service:
> rule: "Host(`service.localhost`)"
> service: "noop@​internal"
> middlewares:
> - "my-ipwhitelistshaper@​file"
> 
> knock-test-service:
> rule: "Host(`knock.localhost`)"
> service: "noop@​internal"
> middlewares:
> - "my-ipwhitelistshaper@​file"
>     
> # Special router to handle the knock-knock endpoint
> knock-knock-router:
> rule: "Host(`knock.localhost`) && Path(`/knock-knock`)"
> service: "noop@​internal"
> middlewares:
> - "my-ipwhitelistshaper@​file"
> priority: 110 # Higher priority than the main router
>       
> # Special router to handle the approval endpoint
> approve-router:
> rule: "Host(`knock.localhost`) && PathPrefix(`/approve`)"
> service: "noop@​internal"
> middlewares:
> - "my-ipwhitelistshaper@​file"
> priority: 110 # Higher priority than the main router
> 
> ```
