diff --git a/proxy/config.dist.php b/proxy/config.dist.php index 9a556e9..de4725b 100644 --- a/proxy/config.dist.php +++ b/proxy/config.dist.php @@ -24,6 +24,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 b031aee..05fd2f0 100644 --- a/proxy/proxy.php +++ b/proxy/proxy.php @@ -21,6 +21,7 @@ $civiproxy_version = '0.6-dev'; */ 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'); }