Skip to content

getClientIPAddress() is returning null #220

Closed Answered by sergiodxa
Azasratruth asked this question in Q&A
Discussion options

You must be logged in to vote

None of the headers used to find out the client IP address is on your request, in that case getClientIPAddress will return null because it couldn't find it.

Those headers are usually added by CDNs, your deployment platform, or another proxy, so in local you either need to run one yourself (e.g. NGINX) or use a fallback only for development.

This is the full list of headers

const headerNames = Object.freeze([
"X-Client-IP",
"X-Forwarded-For",
"HTTP-X-Forwarded-For",
"Fly-Client-IP",
"CF-Connecting-IP",
"Fastly-Client-Ip",
"True-Client-Ip",
"X-Real-IP",
"X-Cluste…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Azasratruth
Comment options

Answer selected by Azasratruth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants