Forward Client IP

Last update:2024-07-17 17:31:41

When your website’s contents are distributed by the CDNetworks CDN platform, user requests are initially directed to CDN servers. If the CDN servers do not have the requested contents cached, requests will be forwarded to your origin server to retrieve the necessary contents. Consequently, in most cases, your origin server will be unable to capture the real IP address of the end client. This can pose challenges if you need to perform business analysis based on the real client IP, such as determining the client’s geographical location or tracking their activity, like post frequency. To address this issue, the CDNetworks CDN platform provides a feature to pass the real client IP to the origin server, ensuring that your website can obtain the end client’s IP address and perform further analysis.

How to Configure Forward Client IP

  1. Log in to the CDNetworks Console and select the appropriate product.
  2. Navigate to the Configuration, locate the domain you wish to configure, and click on Edit Configuration at the top or the Edit button to the right of the domain [Feature Upgrade] Advanced Access Control.
  3. Enter the configuration modification page, find the Forward Client IP under Advanced Configuration, and make the necessary adjustments for one or more domains based on your needs.


The available configuration parameters are as follows:

Parameter Description
Cdn-Src-Ip By default, the CDN platform uses the Cdn-Src-Ip header to retrieve and record the client IP. This header reflects the IP address from which the request originates and connects to the CDN server. No additional configuration is needed, as your origin server can extract the client IP from this header.
X-Forwarded-For When the CDN server initiates a request to the origin server, it automatically includes the X-Forwarded-For header. If you select this parameter in this setting, the header will carry the client IP as obtained by Cdn-Src-Ip.
Pass Original X-Forwarded-For Under normal circumstances, clients include the X-Forwarded-For header when requesting the CDN server. If you choose this parameter, the CDN server will directly transmit the value passed by the client to the origin server when making the request.

After you have completed setting the configurations, please click OK and then select Next to submit your settings. To minimize any potential disruptions to your production environment, we strongly recommend conducting a Pre-deploy test in a staging environment. This crucial step ensures that your configurations are accurate before they go live. Once you have verified the accuracy of the settings, click Deploy Now to implement them in the live environment. The configurations typically become effective within 3-5 minutes. For comprehensive guidance on pre-deployment testing and to verify the effectiveness of your configurations, please consult the tutorial Deploy the Configurations to Staging Environment for Validation.

Notes

lease note that if you select the Pass Original X-Forwarded-For option, there could be cases where clients use proxy IP schemes, as a result, the IP address obtained through this header may not be the real client IP and could contain multiple IP addresses.

Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!