N°3668 - URL direct error: renamed trust_proxies<-behind_reverse_proxy

This commit is contained in:
odain
2021-03-15 14:56:16 +01:00
parent 5d0c61178b
commit 386c90c601
4 changed files with 7 additions and 7 deletions

View File

@@ -783,7 +783,7 @@ class utils
}
/**
* @return bool The boolean value of the conf. "trust_proxies" (except if there is no REMOTE_ADDR int his case, it return false)
* @return bool The boolean value of the conf. "behind_reverse_proxy" (except if there is no REMOTE_ADDR int his case, it return false)
*
* @since 2.7.4
*/
@@ -793,7 +793,7 @@ class utils
return false;
}
$bTrustProxies = (bool) self::GetConfig()->Get('trust_proxies');
$bTrustProxies = (bool) self::GetConfig()->Get('behind_reverse_proxy');
return $bTrustProxies;
}

View File

@@ -1265,13 +1265,13 @@ class Config
'source_of_value' => '',
'show_in_conf_sample' => false,
],
'trust_proxies' => [
'behind_reverse_proxy' => [
'type' => 'bool',
'description' => 'If true, then proxies custom header (X-Forwarded-*) are taken into account. Use only if the webserver is not publicly accessible (reachable only by the reverse proxy)',
'default' => false,
'value' => false,
'source_of_value' => '',
'show_in_conf_sample' => false,
'show_in_conf_sample' => true,
],
);

View File

@@ -144,7 +144,7 @@ class SetupPage extends NiceWebPage
public function output()
{
$sLogo = utils::GetAbsoluteUrlAppRoot(true).'/images/itop-logo.png';
$sLogo = utils::GetAbsoluteUrlAppRoot().'/images/itop-logo.png';
$this->s_content = "<div id=\"header\"><h1><a href=\"http://www.combodo.com/itop\" target=\"_blank\"><img title=\"iTop by Combodo\" alt=\" \" src=\"{$sLogo}?t=".utils::GetCacheBusterTimestamp()."\"></a>&nbsp;".htmlentities($this->s_title,
ENT_QUOTES, self::PAGES_CHARSET)."</h1>\n</div><div id=\"setup\">{$this->s_content}\n</div>\n";

View File

@@ -208,7 +208,7 @@ class UtilsTest extends \Combodo\iTop\Test\UnitTest\ItopTestCase
public function testGetDefaultUrlAppRootPersistWhenTrustProxyActivatedAtFirst($bForceTrustProxy, $bConfTrustProxy, $aServerVars, $sExpectedAppRootUrl)
{
$_SERVER = $aServerVars;
utils::GetConfig()->Set('trust_proxies', $bConfTrustProxy);
utils::GetConfig()->Set('behind_reverse_proxy', $bConfTrustProxy);
$sAppRootUrl = utils::GetDefaultUrlAppRoot($bForceTrustProxy);
$this->assertEquals($sExpectedAppRootUrl, $sAppRootUrl);
$sPersistedExpectedAppRootUrl = $sAppRootUrl;
@@ -231,7 +231,7 @@ class UtilsTest extends \Combodo\iTop\Test\UnitTest\ItopTestCase
public function testGetDefaultUrlAppRoot($bForceTrustProxy, $bConfTrustProxy, $aServerVars, $sExpectedAppRootUrl)
{
$_SERVER = $aServerVars;
utils::GetConfig()->Set('trust_proxies', $bConfTrustProxy);
utils::GetConfig()->Set('behind_reverse_proxy', $bConfTrustProxy);
$sAppRootUrl = utils::GetDefaultUrlAppRoot($bForceTrustProxy);
$this->assertEquals($sExpectedAppRootUrl, $sAppRootUrl);
}