How to Pass a Visitor’s IP Address from Varnish to WordPress Updated on November 19, 2021 by InMotion Hosting Contributor 1 Minutes, 0 Seconds to 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. Share this Article 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 BlaB! AX Maintenance Mode How to Log in to BlaB! AX 6 Ways to Improve Website Accessibility How to Create HTML Pages with the CherryTree Note-Taking Application Connecting with Google Analytics in Jetpack Search Engine Optimization with Jetpack Professional FlatPress Themes and Styles How to Manage User Account Settings in OctoberCMS Force HTTPS in OctoberCMS with RedirectToHTTPS How to Uninstall Plugins in OctoberCMS