diff --git a/proxy/config.dist.php b/proxy/config.dist.php index 24efac2..0624efe 100644 --- a/proxy/config.dist.php +++ b/proxy/config.dist.php @@ -32,6 +32,9 @@ $proxy_base = 'https://proxy.yourdomain.org'; // this should point to the target CiviCRM system $target_civicrm = 'https://your.civicrm.installation.org'; +//if CiviCRM is behind a htaccess authentication, you may set username:password. if empty no auth is used +//$target_civicrm_auth = 'username:password'; + /**************************************************************** ** FEATURES / DEFAULT PATHS ** diff --git a/proxy/proxy.php b/proxy/proxy.php index ed04280..da6ab96 100644 --- a/proxy/proxy.php +++ b/proxy/proxy.php @@ -21,6 +21,7 @@ $civiproxy_version = '1.0.0-alpha2'; */ function civiproxy_redirect($url_requested, $parameters) { global $target_interface; + global $target_civicrm_auth; $url = $url_requested; $curlSession = curl_init(); @@ -52,6 +53,9 @@ function civiproxy_redirect($url_requested, $parameters) { if (!empty($target_interface)) { curl_setopt($curlSession, CURLOPT_INTERFACE, $target_interface); } + if (isset($target_civicrm_auth) and !empty($target_civicrm_auth)) { + curl_setopt($ch, CURLOPT_USERPWD, $target_civicrm_auth); + } if (file_exists(dirname(__FILE__).'/target.pem')) { curl_setopt($curlSession, CURLOPT_CAINFO, dirname(__FILE__).'/target.pem'); }