All guests have the same ip


#1

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.


CPV Lab with Cloudflare. I installed mod_cloudflare but my tracking software is returning 127.0.0.1 as the isp
#2

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.


#3

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


#4

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


#5

?
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


#6

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


#7

Not work
give me 245.122.120.167


#8

Can you create a file containing

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

and post the link to the file here?


#9

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


#10

Works for me.


#11

Real ip?


#12

Absolutely.


#13

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

Not work on me pc


#14

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


#15

It worked a few days ago.

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


#16

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.


#17

Not work on CF
Work on real server ip


#18

Restart CF settings?


#19

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.


#20

Working!!!
Disable WebSockets on options…

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