Live Help

Email

Client portal

REMOTE_ADDR showing server IP

 February 2, 2018     0 Comments

As we are running varnish in front of the apache, REMOTE_ADDR variable will return apache webserver IP address.


If you require the real client IP address, please use the following scripts:

if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] )

     && preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/',

                     $_SERVER['HTTP_X_FORWARDED_FOR'] ) )

        $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];


How helpful was this article to you?

Posting has been disabled.

cPanel Partner NOC