Most companynetworks deal with a proxy for loadbalancing traffic and do caching to save on bandwith. Here we explain how to make sure your WordPress and DigitalSignage plugin work with your proxy server.
Step 1: Add proxy config into the ‘wp-config.php” file
/* Configure proxy Server */
define(‘WP_PROXY_HOST’, ‘proxy.yourdomain.net’); //proxy server
define(‘WP_PROXY_PORT’, ’83’); //proxy port
define(‘WP_PROXY_USERNAME’, ‘domain\username’); //your username or domain\username
define(‘WP_PROXY_PASSWORD’, ‘yourpassword’); //your password
define(‘WP_PROXY_BYPASS_HOSTS’, ‘localhost,*.internaldomain.net,*.internaldomain.com); //domains to exclude from proxy request
Step 2: Add proxy code for “file_get_contents” function at the start of “ds_ajax_handlers.php” file
stream_context_set_default(
array(
‘http’ => array(
‘proxy’ => “tcp://”.WP_PROXY_HOST.”:”.WP_PROXY_PORT,
‘request_fulluri’ => true,
‘header’ => “Proxy-Authorization: Basic $proxyauth”
// Remove the ‘header’ option if proxy authentication is not required
)
)
);
Step 3: Add proxy code to the CURL function in “ds_ajax_handlers.php” file
Add the following code between “curl_setopt($_195, CURLOPT_CONNECTTIMEOUT, 0);” and “curl_setopt($_195,CURLOPT_FOLLOWLOCATION,true);”
curl_setopt($_195,CURLOPT_PROXY, WP_PROXY_HOST);curl_setopt($_195,CURLOPT_PROXYPORT,WP_PROXY_PORT);curl_setopt($_195,CURLOPT_PROXYUSERPWD,WP_PROXY_USERNAME.”:”.WP_PROXY_PASSWORD);