pbojinov / request-ip

A Node.js module for retrieving a request's IP address on the server.
https://npmjs.com/package/request-ip
MIT License
823 stars 102 forks source link

Add support for Cloudflare's "Cf-Pseudo-IPv4" header (as a last resort) #46

Closed Sv443 closed 2 years ago

Sv443 commented 4 years ago

In Cloudflare, you have the option to enable a pseudo-IPv4 header for servers that don't fully support IPv6. If this feature is enabled, every request will have a "Cf-Pseudo-IPv4" header which contains an IPv4 address. It would be cool if you could add this as a last fallback that gets tried if every other header fails.
Here's an article on it: https://blog.cloudflare.com/eliminating-the-last-reasons-to-not-enable-ipv6/#introducingpseudoipv4

pbojinov commented 2 years ago

@Sv443 just wanted to let you know that I've added support for this. Will cut a new version with this shortly.