After searching a bit, I found these old issues on the icanhazip archive repo that could be related to your issue:
icanhazip is owned & maintained by Cloudflare since 2021 (blog post annoucement). I don’t know what Cloudflare did on the code since then, and I can’t reproduce the error on my end, unfortunately.
I see 3 possible fixes:
- Check the format of the string returned by the request. If it contains dots
.
where we expected IPv6 or if it contains:
where we expected IPv4, don’t display the incorrect value. It’s an easy regex fix that could do the job. - Force each
HttpClient
request to use respectively IPv4 or IPv6. (Example). Not sure if it’ll help if the provider is returning the incorrect the value anyway. - Customize Public IP Providers. It’s a planned feature that would mitigate the issue if icanhazip is struggling to return the correct public ip.