How to Pass a Visitor’s IP Address from Varnish to WordPress InMotion Hosting ContributorUpdated on November 19, 2021 1 Minute Read Varnish caching can speed up the loading time of your website. Varnish listens on port 80 and passes data to the default HTTP application. This means that the HTTP log files will show your server’s IP instead of the actual remote IP of the visitor. This article will provide options for passing the remote IP to WordPress. Get a Visitor’s IP Address for a WordPress Site Login to cPanelOpen File ManagerOpen your wp-config.php file in the Code EditorAdd the following code as a new line after the first line: if ( isset( $_SERVER[ "HTTP_X_FORWARDED_FOR" ])){ $_SERVER[ 'REMOTE_ADDR' ] = $_SERVER[ "HTTP_X_FORWARDED_FOR" ];} Get a Visitor’s IP Address for All Sites by PHP Version Login to your server via SSH as rootCreate a PHP file at “/usr/local/php/remoteIP.php” with the following contents: <?php if ( isset( $_SERVER[ "HTTP_X_FORWARDED_FOR" ])){ $_SERVER[ 'REMOTE_ADDR' ] = $_SERVER[ "HTTP_X_FORWARDED_FOR" ]; }?>Login to WHM as rootOpen the MultiPHP INI EditorAdd the full path for your new file at the end of the line that starts with “auto_prepend_file”Finally, click Save Congratulations! You are now able to pass the correct IP address to WordPress from Varnish. Summarize and Research with AIShare on Social Media InMotion Hosting Contributor Content Writer InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals! More Articles by InMotion Hosting Related Articles How to Upload Large Files Without FTP Timeouts eCommerce – Setup your Merchant Account Gateway How to Zip and Unzip Files on Windows 11 and Windows 10 How to Transfer and Backup Website Files with Rsync .htaccess File Reference List: Rules, Fixes, and Uses How to Force a File Download With .htaccess Redirecting Visitors to an Under Construction Page How to Force www and non-www on Your Domain with .htaccess How to Use the .htaccess File Domain Resolves to Server Default Page