All guests have the same ip

In php:
u_ip = _SERVER[“HTTP_CF_CONNECTING_IP”];

All tests give me: 245.122.120.167
But this is not my ip or my friend.

First of all, you should not rely on HTTP_CF_CONNECTING_IP but use mod_remoteip instead.

Second, the address you mentioned is not a public address and should never show up as request. You likely have it statically assigned somewhere.

2 Likes

I’m use
a2enmod remoteip on console

add OPTION1(https://forums.cpanel.net/threads/configure-mod_remoteip-for-Cloudflare.640101/) to apache2(site-ssl)

and restart apache2

In php: ???
u_ip = _SERVER[‘REMOTE_ADDR’]; ???

not work, give me “172.68.214.43” - not my ip

Enabling it alone is not enough, you’ll also need to configure it, so that it properly functions in a Cloudflare context.

See https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html and https://www.cloudflare.com/ips/ for that

?
RemoteIPHeader CF-Connecting-IP
RemoteIPTrustedProxy 103.21.244.0/22
RemoteIPTrustedProxy 103.22.200.0/22
RemoteIPTrustedProxy 103.31.4.0/22
RemoteIPTrustedProxy 104.16.0.0/12
RemoteIPTrustedProxy 108.162.192.0/18
RemoteIPTrustedProxy 131.0.72.0/22
RemoteIPTrustedProxy 141.101.64.0/18
RemoteIPTrustedProxy 162.158.0.0/15
RemoteIPTrustedProxy 172.64.0.0/13
RemoteIPTrustedProxy 173.245.48.0/20
RemoteIPTrustedProxy 188.114.96.0/20
RemoteIPTrustedProxy 190.93.240.0/20
RemoteIPTrustedProxy 197.234.240.0/22
RemoteIPTrustedProxy 198.41.128.0/17
RemoteIPTrustedProxy 2400:cb00::/32
RemoteIPTrustedProxy 2405:b500::/32
RemoteIPTrustedProxy 2606:4700::/32
RemoteIPTrustedProxy 2803:f800::/32
RemoteIPTrustedProxy 2c0f:f248::/32
RemoteIPTrustedProxy 2a06:98c0::/29

Looks good. Try it, if it doesnt work try specifying the addresses space separated in one entry. Either of both should work.

Not work
give me 245.122.120.167

Can you create a file containing

<?php echo $_SERVER['REMOTE_ADDR']; ?>

and post the link to the file here?

https://api.fireguard.pl/?auth.get.key

Works for me.

Real ip?

Absolutely.

curl https://api.fireguard.pl/?auth.get.key
on server display real ip

Not work on me pc

Maybe you are statically assigning it in some cases. You need to debug your code, it must be an issue somewhere there.

It worked a few days ago.

At 100% it’s not my ip, when I connect to ssh I have another one.

Again, create a file containing

<?php echo $_SERVER['REMOTE_ADDR']; ?>

and nothing else and try that. If you dont have any preloaded PHP code and no other Apache modules that should definitely show the accurate address.

Not work on CF
Work on real server ip

Restart CF settings?

You do need to reload Apache when you enabled mod_remoteip but considering it already seemed to work I would not think that is the issue.

Create a file with exactly that content and nothing else

<?php echo 'A ' . $_SERVER['REMOTE_ADDR'] . '.... B' . $_SERVER['HTTP_CF_CONNECTING_IP']; ?>

and post the link here.

Working!!!
Disable WebSockets on options…

Check - https://api.fireguard.pl/?auth.get.key