Same IP for all visitors


Peqi is positioned between your website's visitors and your hosting server, and because of this mediation, the IP that appears in your hosting server's network logs will be Peqi's IP, not the actual visitor's.

This can be problematic for applications that need to correctly identify the visitor's IP address, for example, to personalize content, manage user sessions, or apply geographic access restrictions.

To overcome this limitation and obtain the real IP of the visitor, a common practice is to use the HTTP X-Forwarded-For (XFF) header. This header is added by Peqi to the requests it forwards to the hosting server, however, it is necessary for your web server to be configured to trust this header in requests made from our server. In this way, in addition to X-Forwarded-For, we also send X-Peqi-Real-Ip and X-Peqi-Forwarded-For which contains the real IP of the visitor, and you can configure it at the application level.

To integrate this functionality, you will need to configure your application to extract the visitor's IP address from the headers X-Forwarded-For, X-Peqi-Real-Ip or X-Peqi-Forwarded-For. This configuration varies depending on the technology used, but generally involves modifying the server's settings or code to recognize and use the IP listed in this header as the visitor's IP address.

NGINX

The ngx_http_realip_module module must be enabled and installed on your server's NGINX. Once you have activated the mentioned module, follow the steps below:


# Define which header you want to print the real client's IP from
real_ip_header X-Forwarded-For;
# Define Peqi's IPs as trusted so that the above context is valid
set_real_ip_from 45.33.21.140/32;
set_real_ip_from 45.33.21.46/32;
set_real_ip_from 45.33.21.223/32;
set_real_ip_from 45.79.42.243/32;

Related Articles