If you’ve ever tried running WordPress behind a proxy server, you’ll quickly run into error messages and find out just how troublesome it can really be. The good news, though, is that there’s a pretty easy fix.
WordPress is the world’s most popular content management system. During the course of doing its job, WordPress needs to connect with other websites to check for updates or to pull in a Twitter feed for example. The problem, though, is that it can’t when running behind a proxy, because the outgoing connections haven’t been routed through the proxy server. This is a common scenario on corporate and academic networks. The result is that you won’t be notified of updates to your themes, plugins and WordPress core, and to top it off you’ll see the error message below plastered across your Admin dashboard.
Warning: An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href=”https://wordpress.org/support/” target=”_blank”>support forums. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in C:\xampp\htdocs\wordpress\wp-includes\update.php on line 479
To fix the error message and to enable WordPress to function correctly you need to tell WordPress about your network proxy. I know this sounds complicated, but trust me, it isn’t.
To get started you need to gather the following information:
- The network address of your proxy server e.g. proxy.atyourdomain.net
- The port number you need to connect to the proxy server e.g. 8080
- A username for the proxy server
- A password for the proxy server
Once you have your proxy server details you need enter the following lines into your wp-config.php replacing the settings below with your own.
/* Proxy Authentication Details */ define('WP_PROXY_HOST', 'poxy.serveraddress'); define('WP_PROXY_PORT', 'proxy_port_number'); define('WP_PROXY_USERNAME', 'your_username'); define('WP_PROXY_PASSWORD', 'your_password'); define('WP_PROXY_BYPASS_HOSTS', 'localhost');
I chose to enter my proxy details at the top, right before the database details section.
Even though running WordPress behind a proxy server can be frustrating, I hope this post helped you fix the problems you were running into. If it did, I’d love to hear from you or if you’ve run into other errors with WordPress behind a proxy, I’d love to hear how you went about solving them in the comment section below, so we can hopefully help others too.