Title: HTTP X FORWARDED FOR
Last modified: March 22, 2021

---

# HTTP X FORWARDED FOR

 *  Resolved [Dan14](https://wordpress.org/support/users/dan14/)
 * (@dan14)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/http-x-forwarded-for/)
 * For my CDN I must use x forwarded for header to get clients ips. I know about
   apache moduled mod rewrite, im currently on shared hosting so there is little
   room for adjustments.
 * I would like to know if w3 total cache supports x forwarded for header, if not,
   I would to know whether the following can be accomplished in htaccess or wp-config
   and how it needs to be written? Regarding the txt, I will upload it via FTP.
 * RemoteIPHeader X-Forwarded-For
    RemoteIPTrustedProxyList conf/StackPath-ipblocks.
   txt
    -  This topic was modified 5 years, 1 month ago by [Dan14](https://wordpress.org/support/users/dan14/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Contributor [Marko Vasiljevic](https://wordpress.org/support/users/vmarko/)
 * (@vmarko)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/http-x-forwarded-for/#post-14217123)
 * Hello [@dan14](https://wordpress.org/support/users/dan14/)
 * Thank you for your inquiry and I am happy to assist you with this.
    No, W3 Total
   Cache does not support that. What you need is mod_remoteip enabled, so yes this
   can be done via apache. Please check this [document](https://httpd.apache.org/docs/current/mod/mod_remoteip.html)
   for more info. Thanks!
 *  Thread Starter [Dan14](https://wordpress.org/support/users/dan14/)
 * (@dan14)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/http-x-forwarded-for/#post-14217731)
 * Thank you.
 * I know this has nothing to do with w3 total cache but I cannot touch the modules.
   The only solution I have is to use php, which will work. If you take this code
   for example:
 * // Use X-Forwarded-For HTTP Header to Get Visitor’s Real IP Address
    if ( isset(
   $_SERVER[‘HTTP_X_FORWARDED_FOR’] ) ) { $http_x_headers = explode( ‘,’, $_SERVER[‘
   HTTP_X_FORWARDED_FOR’] ); $_SERVER[‘REMOTE_ADDR’] = $http_x_headers[0]; }
 * I want to upload a list of ips in .txt file. How can I add that .txt file to 
   the php script. For example, IPTrustedProxyList /wp-content/trusted.txt

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘HTTP X FORWARDED FOR’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Dan14](https://wordpress.org/support/users/dan14/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/http-x-forwarded-for/#post-14217731)
 * Status: resolved