Bypass Cache still using Cloudflare IPs

I am having an issue with our payment gateway wanting to validate IP’s addresses that are POSTing to a URL of ours. I have a rule to bypass the cache – pattern: domain.com/?give-listener=ITN I have also set Cloudflare to development mode to test hoping to bypass cache/proxy.

When looking at the logs, I see that the remote addr IP that is hitting the relevant URL is 162.158.159.35 which is a Cloudflare IP, not the origin payment gateway’s IP. This causes the validation to break.

How do I ensure that Cloudflare passes the origin IP address to the URL?

Cloudflare passes the request’s IP address through the request headers:

2 Likes

Thanks @sdayman. For future PHP users:

$remote_ip = $_SERVER['HTTP_CF_CONNECTING_IP'] ?: $_SERVER['REMOTE_ADDR'];
2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.