IPv6 reverse proxy address not being recognised from trusted_proxies list

I updated recently which broke my reverse proxy (in my case, IIS). Reading the release notes, it was because I had never set up the “use_x_forwarded_for: true” and “trusted_proxies:” config. My network is fully set up for IPv6 so all clients use that rather than IPv4. I’ve updated my HA config to include the above config lines but I’m still seeing the following error (IPv6 addresses are not mine, taken from some random example to anonymise):

Invalid IP address in X-Forwarded-For: [2406:xxxx:x:xxxx:0000:8a2e:0370:7334]

In my trusted_proxies list I have the following:

I have also tried specifying the exact IP as listed above in the error with no change

So, my theory as to why it’s not working is because IIS is passing on the address with around the IP. I can’t put square brackets around the IP in the my Home Assistant config as that’s a reserved character. Assuming this is the issue, IIS isn’t exactly wrong to include 's - it’s a valid way to reference and use an IPv6 address and I feel HA should too.

Of course, I could also have got the config wrong for IPv6 and I’d welcome any assistance with getting that correct if that’s the case.

1 Like

It is a bit long ago, but maybe helpful for others reading this and having the same issue:

Just remove the ‘/64’ from the IPv6 address string.

For me this solved the issue.