fix:get domain path

This commit is contained in:
qkqpttgf 2020-01-20 18:30:43 +08:00 committed by GitHub
parent 44f14d9af6
commit 3f54114145
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -30,8 +30,8 @@ function GetPathSetting($event, $context)
$_SERVER['function_name'] = $context['function_name'];
$_SERVER['namespace'] = $context['namespace'];
$host_name = $event['headers']['host'];
$_SERVER['HTTP_HOST'] = $host_name;
$serviceId = $event['requestContext']['serviceId'];
$_SERVER['list_path'] = getListpath($host_name);
if ( $serviceId === substr($host_name,0,strlen($serviceId)) ) {
$_SERVER['base_path'] = '/'.$event['requestContext']['stage'].'/'.$_SERVER['function_name'].'/';
$_SERVER['Region'] = substr($host_name, strpos($host_name, '.')+1);
@ -43,9 +43,6 @@ function GetPathSetting($event, $context)
$path = substr($event['path'], strlen($event['requestContext']['path']));
}
if (substr($path,-1)=='/') $path=substr($path,0,-1);
if (empty($_SERVER['list_path'])) {
$_SERVER['list_path'] = '/';
}
$_SERVER['is_guestup_path'] = is_guestup_path($path);
$_SERVER['PHP_SELF'] = path_format($_SERVER['base_path'] . $path);
$_SERVER['REMOTE_ADDR'] = $event['requestContext']['sourceIp'];