Merge pull request #10616 from s-kerdel/10615-Respect-SS_BASE_URL-for-CLI-RequestBuilder

FIX Respect SS_BASE_URL scheme in CLI environment
This commit is contained in:
Guy Sartorelli 2022-12-20 11:38:12 +13:00 committed by GitHub
commit 3564f98c9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -64,6 +64,13 @@ class CLIRequestBuilder extends HTTPRequestBuilder
$variables['_GET']['url'] = $variables['_SERVER']['argv'][1];
$variables['_SERVER']['REQUEST_URI'] = $variables['_SERVER']['argv'][1];
}
// Set 'HTTPS' and 'SSL' flag for CLI depending on SS_BASE_URL scheme value.
$scheme = parse_url(Environment::getEnv('SS_BASE_URL') ?? '', PHP_URL_SCHEME);
if ($scheme == 'https') {
$variables['_SERVER']['HTTPS'] = 'on';
$variables['_SERVER']['SSL'] = true;
}
// Parse rest of variables as standard
return parent::cleanEnvironment($variables);