Press "Enter" to skip to content

How to see the exact IP Address when using cloudflare?

0

Hi everyone, When you are using Cloudflare it will mask the Client Ip address, So cloudflare provide us variable that help to find the actual IP address of users.

Check below to code the variable of Cloudflare Ip address.

$_SERVER["HTTP_CF_CONNECTING_IP"] //It will provide the real visitor Ip address

If you are using PHP, then you can do use the below code to get the Ip address, that handle both case you are using Cloudflare or when, In case you have changed.

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

Above code will return IP address, when your are using cloudflare, or when you are not using it too.

How to set up the Permission on Laravel file structure.
Configuration setting for .conf file in apache