RocketLoader and CF Real IP Function

Hi there,

Been a long time Cloudflare user but first time in here. So, I have a question that I hope someone could help me with.

I have a script on my website that need to get the visitor real ip address. And based on Cloudflare KB page, I can achieve this by using the guide on this page :

At first, the real IP address won’t be shown on my webpage. I’ve been tinkering around about a day and it always failed. And then decided to test it using my other domain on Cloudflare, and somehow the script that I placed on this domain is always works. So, I check all the setting on both domain, and the difference that on the first domain I enabled Rocket Loader and on the second one I didn’t.

It seems Rocket Loader in conflicting on the real ip function, so it won’t show the real IP even after all the extra config being placed. Disabling the Rocket Loader function, and clearing the cache instantly enable the first site getting the real visitor IP.

Is this a bug or is it on purposely designed like that? Also how if I want to get the real IP and still want to enable the Rocket Loader function?



Have you tried this step?

1 Like

I’ve used this snippet of PHP in the past to set the visitors IP in a variable for further use (regardless of it being direct or Cloudflare proxied traffic):


It’s been a while since I used it so not sure if this suffers from the issue you have of failing when RocketLoader is used but I’m pretty sure I didn’t have any errors when I was using it. This was a while back though but may be worth a try??

EDIT: Just realised that naturally this wouldn’t have been impacted by RocketLoader as it’s all server-side and I guess you’re using client-side JS?? However I’ll leave it here just in case anyone with similar issues see your thread in future. your best bet is prob disabling RL for your script as @anon13899255 suggests.

1 Like