get real client ip behind cloudflare proxy
pmhk
PROOP

2 months ago



Hi,

I have search the community and found it should be "CF-Connecting-IPheader". However my http log I found the client ip is "srcIp". What is the correct way of getting client ip?

the url is : https://m.xyz.com/m/00002

Regards,

Steve

Solved$10 Bounty

4 Replies

Railway
BOT

2 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


brody
EMPLOYEE

2 months ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 2 months ago


pmhk
PROOP

2 months ago

Is "srcIp" reliable source of client ip address?


pmhk
PROOP

2 months ago

got the answer from grok. I should use

req.realIp = req.headers['cf-connecting-ip'] || req.ip;

Attachments


Status changed to Open ray-chen 2 months ago


ray-chen
EMPLOYEE

2 months ago

Yup, that is indeed accurate!


Status changed to Solved ray-chen 2 months ago


Loading...