Invalid ip address

I want to thank you for your services. But I have a problem. When I login to my sites, my country is defined as USA, although I live in another country. I tried to enter from different devices and ip addresses, everywhere the same. Can you please tell me how to solve the problem? Thank you

Are you restoring visitor IPs on your server? Otherwise, you would see Cloudflare’s IPs for every visitor.

3 Likes

I’ve been using shared hosting on my sites for over a year. I’ve never had a problem like this before. The problem occurred about 2 weeks ago

Yes, by the way I get Cloudflare’s ip address instead of my ip address

I have a web tools site. I will leave the link, you can see that in the ip lookup section it shows the Cloudflare address, although it should show the ip address of the visitor. And so I have it on all 5 sites connected to cloudflare

toolfy net/ip-lookup

You need to restore the original visitor IPs as posted by @Laudian.

While your script may have worked for years, the domain name you gave was only registered 10 days ago so I assume this is the first time you’ve run it under Cloudflare. Since the Cloudflare proxy is making the requests to your origin, your script will always show a Cloudflare IP address unless you configure the origin webserver as shown.

1 Like

Thanks for the information. But I’m using shared hosting. Can you tell me what can be done in this case?

If this is a problem for you, you can either change your host or disable Cloudflare on your domain.

Also see:

1 Like

You should be able to read the CF-Connecting-IP HTTP header in your script.

2 Likes

That’s weird. I use Cloudflare all the time and never had this problem.

I have talked to the script developer and to Namechep hosting. There are no problems on their end. I also turned off Cloudflare proxying and everything worked correctly. And I have 5 sites and all with different developers, so the problem is clearly on the Cloudflare side. And most importantly, I have been using Cloudflare for over 3 years and never had this problem. Can you please tell me how I can contact Cloudflare support?

That is expected because the Cloudflare proxy isn’t making the request to your origin. Can you post a link to the same tool on another site that you say has worked for years with Cloudflare?

2 Likes

Here are 2 sites that work through Cloudflare:

66tool. com
onlinetexttoolz. com

And that’s not even the point. I have 5 sites, all with different developers. And they all worked properly. Now all sites get ip address Cloudflare. I.e. the problem is not on the side of hosting and developer, so before that it worked fine.

The need to restore visitor IPs isn’t a change in Cloudflare’s side. The same information is being sent in the same manner.

While I don’t doubt it ‘just worked’ previously the data being sent is unchanged. It f the data being sent is unchanged and it used to work, the logical conclusion is that the origins that don’t work aren’t configured to restore the visitor IP while the ones which do work are configured to do so.

3 Likes

Those 2 sites are returning the correct IP to me. Are they on the same origin server as the one that is giving a Cloudflare IP?

I can’t tell what hosting they are on, they are not my sites. But that’s not the question. Everything has always worked. There were no changes on the hosting side. Here is my other site, it once had the same script, found in the web archive. You can check it out. And it was always connected to Cloudflare and hosted by Namecheap.

(https://web.archive.org/web/20230324165447/https://task.az/ip-lookup)

I f they aren’t your sites and they are using Cloudflare then the site operator is restoring the visitor IP addresses.

There is no question. The method for obtaining visitor IP addresses has been provided. There is no issue with Cloudflare. There is no change with how Cloudflare behaves.

Restore visitor IPs and get the correct data. Don’t restore visitor IPs and get Cloudflare IP addresses instead. The choice is yours to make.

1 Like

Okay, thanks for the answer. How do I do this if I have a shared server?

At the beginning of your script, you must read the IP address somewhere.

Do something like this:

if (request.headers contains "CF-Connecting-IP") then
    ip = request.headers["CF-Connecting-IP"]
else
    ip = request.source_ip

Adjust for whatever language / framework you are using, obviously.

Just be aware, this is not foolproof. Someone who wants to could send you requests with fake-IPs if your server is not configured to only accept requests from Cloudflare.

1 Like