mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUG Fix issue when SS_ALLOWED_HOSTS is run in CLI
This commit is contained in:
parent
31db269f71
commit
5ace4905c9
@ -184,9 +184,10 @@ if(!isset($_SERVER['HTTP_HOST'])) {
|
||||
}
|
||||
}
|
||||
|
||||
if (defined('SS_ALLOWED_HOSTS')) {
|
||||
// Filter by configured allowed hosts
|
||||
if (defined('SS_ALLOWED_HOSTS') && php_sapi_name() !== "cli") {
|
||||
$all_allowed_hosts = explode(',', SS_ALLOWED_HOSTS);
|
||||
if (!in_array($_SERVER['HTTP_HOST'], $all_allowed_hosts)) {
|
||||
if (!isset($_SERVER['HTTP_HOST']) || !in_array($_SERVER['HTTP_HOST'], $all_allowed_hosts)) {
|
||||
header('HTTP/1.1 400 Invalid Host', true, 400);
|
||||
die();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user