誤ったレスポンスコードを修正&追加・サーバー停止時にAPIでは専用のJSONを返答するように変更
This commit is contained in:
parent
18f1a957b9
commit
00c7c8787b
|
|
@ -26,6 +26,7 @@ ErrorDocument 403 /errorpage/httperror.php
|
||||||
ErrorDocument 404 /errorpage/httperror.php
|
ErrorDocument 404 /errorpage/httperror.php
|
||||||
ErrorDocument 413 /errorpage/httperror.php
|
ErrorDocument 413 /errorpage/httperror.php
|
||||||
ErrorDocument 500 /errorpage/httperror.php
|
ErrorDocument 500 /errorpage/httperror.php
|
||||||
|
ErrorDocument 502 /errorpage/httperror.php
|
||||||
ErrorDocument 503 /errorpage/httperror.php
|
ErrorDocument 503 /errorpage/httperror.php
|
||||||
|
|
||||||
# --- セキュリティヘッダ ---
|
# --- セキュリティヘッダ ---
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,9 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) {
|
||||||
$response = array(
|
$response = array(
|
||||||
'error_code' => "critical_error_userdata_not_found",
|
'error_code' => "critical_error_userdata_not_found",
|
||||||
);
|
);
|
||||||
|
http_response_code(500);
|
||||||
}else{
|
}else{
|
||||||
|
http_response_code(200);
|
||||||
$roles = explode(',', $userdata["role"]);
|
$roles = explode(',', $userdata["role"]);
|
||||||
if(!(empty($roles))){
|
if(!(empty($roles))){
|
||||||
foreach ($roles as $roleId) {
|
foreach ($roles as $roleId) {
|
||||||
|
|
@ -87,7 +89,7 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) {
|
||||||
$role[] = $roleinfo;
|
$role[] = $roleinfo;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$role[] = "";
|
$role = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(empty($userdata["sacinfo"]))){
|
if(!(empty($userdata["sacinfo"]))){
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ if(isset($_GET['session']) || (!(empty($Get_Post_Json)))) {
|
||||||
'error_code' => $err,
|
'error_code' => $err,
|
||||||
'success' => false
|
'success' => false
|
||||||
);
|
);
|
||||||
http_response_code(401);
|
http_response_code(400);
|
||||||
echo json_encode($response, JSON_UNESCAPED_UNICODE);
|
echo json_encode($response, JSON_UNESCAPED_UNICODE);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,9 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) {
|
||||||
$response = array(
|
$response = array(
|
||||||
'error_code' => "critical_error_userdata_not_found",
|
'error_code' => "critical_error_userdata_not_found",
|
||||||
);
|
);
|
||||||
|
http_response_code(400);
|
||||||
}else{
|
}else{
|
||||||
|
http_response_code(200);
|
||||||
$roles = explode(',', $userdata["role"]);
|
$roles = explode(',', $userdata["role"]);
|
||||||
if(!(empty($roles))){
|
if(!(empty($roles))){
|
||||||
foreach ($roles as $roleId) {
|
foreach ($roles as $roleId) {
|
||||||
|
|
@ -103,7 +105,7 @@ if(isset($_GET['token']) || (!(empty($Get_Post_Json)))) {
|
||||||
$role[] = $roleinfo;
|
$role[] = $roleinfo;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$role[] = "";
|
$role = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(empty($userdata["sacinfo"]))){
|
if(!(empty($userdata["sacinfo"]))){
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"error_code": "server_down"
|
||||||
|
}
|
||||||
|
|
@ -143,8 +143,12 @@ if( !empty($_POST['serverstop_btn_submit']) ) {
|
||||||
|
|
||||||
// htaccess用意
|
// htaccess用意
|
||||||
$htaccess = "
|
$htaccess = "
|
||||||
ErrorDocument 403 /errorpage/serverstop.php
|
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
|
|
||||||
|
RewriteCond %{REQUEST_URI} ^/api/.*$
|
||||||
|
RewriteRule ^.*$ /errorpage/serverstop.json [R=500,L]
|
||||||
|
|
||||||
|
ErrorDocument 403 /errorpage/serverstop.php
|
||||||
RewriteCond %{REQUEST_URI} !=/function/function.php
|
RewriteCond %{REQUEST_URI} !=/function/function.php
|
||||||
RewriteCond %{REQUEST_URI} !=/errorpage/serverstop.php
|
RewriteCond %{REQUEST_URI} !=/errorpage/serverstop.php
|
||||||
RewriteCond %{REQUEST_URI} !=/css/home.css
|
RewriteCond %{REQUEST_URI} !=/css/home.css
|
||||||
|
|
@ -244,4 +248,4 @@ require('../logout/logout.php');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue