If you want to handle the IP address in Codeigniter 3, but not on the web server, you can add the IP CDN to this configuration:
$config['proxy_ips'] = ['10.0.1.2'];
or assigning a CDN network mask:
$config['proxy_ips'] = '10.0.1.0/24';
If your server is always behind the CDN:
$config['proxy_ips'] = isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : '';
Get the IP method:
$this->input->ip_address();
It will return the IP address if the proxy IP address matches, otherwise it will return $_SERVER["REMOTE_ADDR"] , which can get the real IP address of the client.
Referring to Codeigniter 3
source share