[Support request] Could you please help me where to add the X-Forwarded-For code in the wp-config.

Home Forums Support [Support request] Could you please help me where to add the X-Forwarded-For code in the wp-config.

Home Forums Support Could you please help me where to add the X-Forwarded-For code in the wp-config.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1247636
    rajkumarsm

    Hi there.

    I would like to implement XFF for my site.

    Could you please help me where to add the X-Forwarded-For code in the wp-config.php file?

    // 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];
    
    }

    Thanks in advance
    STM

    #1247824
    David
    Staff
    Customer Support

    Hi there,

    the wp-config.php file can be found in the Root folder of your Website. You will need to access this file using FTP or any file editor that your hosts server panel provides.

    If you don’t know how to do this then speak with your Hosting provider

    #1297341
    Muhammad

    Where in the file should we add it

    #1297519
    Leo
    Staff
    Customer Support

    I would assume you can add it at the end of the file.

    You might need to check with whoever provided the code for this as it’s not theme related.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.