M
M
Matthew Stafford2019-08-29 17:40:07
PHP
Matthew Stafford, 2019-08-29 17:40:07

How to get the real IP of the visitor?

Hello everyone, I connected CloudFlare and it replaces users' IPs with their own.
I found a code on the Internet that supposedly should transmit a real IP, but CloudFlare seems to encrypt them.

if(isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
  $_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}

So how do you get a real IP address?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2019-08-29
@dimonchik2013

https://support.cloudflare.com/hc/en-us/articles/2...
nginx.org/en/docs/http/ngx_http_realip_module.html
https://community.cloudflare.com/t/how-to -track-ip...
https://support.cloudflare.com/hc/en-us/sections/2...
in short, set up nginx correctly, look at the forwarded header and see if you are reading ngix IP with your application

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question