智一面

$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https' : 'http';
if ($http_type === "http") {
    $baseUrl = Url::base('http');
} else {
    $baseUrl = Url::base('https');
}