• Resolved Dan14

    (@dan14)


    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 3 years, 11 months ago by Dan14.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @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 for more info.
    Thanks!

    Thread Starter Dan14

    (@dan14)

    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.