This is a mirror of official site: http://jasper-net.blogspot.com/

HTTP_X_FORWARDED_FOR, HTTP_VIA and REMOTE_ADDR Explained

| Tuesday, August 23, 2011
These PHP server variables provide the IP address information in different ways based on the condition how the website is accessed. So basically these variables used to track the user’s location.

You can get these information with the help of below three server variables.

    REMOTE_ADDR
    HTTP_VIA
    HTTP_X_FORWARDED_FOR


When any user visit your site without any proxy server in that case you can get the IP address using REMOTE_ADDR server variable. So in that case HTTP_X_FORWARDED_FOR and HTTP_VIA will not be available.

    Note: HTTP_VIA and HTTP_X_FORWARDED_FOR will be only populated if web server detects the use of the Proxy Server.

Now for understanding the HTTP_VIA and HTTP_X_FORWARDED_FOR check the below scenario:

Suppose any user from India visits my site from the proxy server of the USA. Below I have listed the user’s flow with dummy IP addresses.

User( India 1.25.32.51 ) >> Proxy (USA 54.58.210.255) >> http://www.xpertdeveloper.com

Read more: XPert developer
QR: https://chart.googleapis.com/chart?chs=80x80&cht=qr&choe=UTF-8&chl=http://www.xpertdeveloper.com/2011/08/http_x_forwarded_for-http_via-and-remote_addr-explained/

Posted via email from Jasper-net

0 comments: