Title: Breakage when using HTTP proxy
Last modified: December 19, 2016

---

# Breakage when using HTTP proxy

 *  Resolved [Dick Visser](https://wordpress.org/support/users/usrlocaldick/)
 * (@usrlocaldick)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/breakage-when-using-http-proxy/)
 * For security reasons the systems that run WP here can only get to internet via
   an HTTP proxy.
    See [https://developer.wordpress.org/reference/classes/wp_http_proxy/](https://developer.wordpress.org/reference/classes/wp_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 [https://analyticsreporting.googleapis.com](https://analyticsreporting.googleapis.com),
   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)

 *  [Brandon (ShareThis Support)](https://wordpress.org/support/users/brandonsharethis/)
 * (@brandonsharethis)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/breakage-when-using-http-proxy/#post-8573579)
 * Hey [@usrlocaldick](https://wordpress.org/support/users/usrlocaldick/),
 * Thank you so much for providing feedback and a fix!
    Our engineering team found
   your work to be super helpful and have given you credit in the latest change 
   log. You can view the kudos here: [https://wordpress.org/plugins/googleanalytics/changelog/](https://wordpress.org/plugins/googleanalytics/changelog/)
 * Thanks again for the amazing feedback, we appreciate you!

Viewing 1 replies (of 1 total)

The topic ‘Breakage when using HTTP proxy’ is closed to new replies.

 * ![](https://ps.w.org/googleanalytics/assets/icon-256x256.jpg?rev=2624799)
 * [ShareThis Dashboard for Google Analytics](https://wordpress.org/plugins/googleanalytics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/googleanalytics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/googleanalytics/)
 * [Active Topics](https://wordpress.org/support/plugin/googleanalytics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/googleanalytics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/googleanalytics/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Brandon (ShareThis Support)](https://wordpress.org/support/users/brandonsharethis/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/breakage-when-using-http-proxy/#post-8573579)
 * Status: resolved