Support » Plugin: Google Analytics » Breakage when using HTTP proxy

  • Resolved Dick Visser


    For security reasons the systems that run WP here can only get to internet via an HTTP proxy.

    The old version of this plugin did not request any URLs by itself, it merely added the tracking code. The new version 2.x seems to do HTTP requests for URLs like, but it does not take into account any of the WP_PROXY_* constants that are set in wp-config.php.
    This will make the plugin do request on it’s own without proxy settings, and thus fail and kill the site.

    Adding this code after line 80 of lib/Ga_Lib_Api_Requests.php will make the plugin use any defined WP_PROXY_* constants:

    // Set the proxy configuration. The user can provide this in wp-config.php
    if (defined(‘WP_PROXY_HOST’)) {
    curl_setopt($ch, CURLOPT_PROXY, WP_PROXY_HOST);
    if (defined(‘WP_PROXY_PORT’)) {
    curl_setopt($ch, CURLOPT_PROXYPORT, WP_PROXY_PORT);
    if (defined(‘WP_PROXY_USERNAME’)){
    $auth = WP_PROXY_USERNAME;
    if (defined(‘WP_PROXY_PASSWORD’)){
    $auth .= ‘:’ . WP_PROXY_PASSWORD;
    curl_setopt($ch, CURLOPT_PROXYUSERPWD, $auth);

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Breakage when using HTTP proxy’ is closed to new replies.