|
|
@@ -23,9 +23,11 @@ final class ApiBoundary implements MiddlewareInterface
|
|
|
$origin = (string) $request->header('origin', '');
|
|
|
$origins = (array) config('mini_api.allowed_origins', []);
|
|
|
$started = microtime(true);
|
|
|
- if ($origin !== '' && !in_array($origin, $origins, true)) {
|
|
|
- $response = ApiResponse::error($request, new ApiException(40301, '不允许的访问来源', 403));
|
|
|
- } elseif ($request->method() === 'OPTIONS') {
|
|
|
+ // 临时停用 Origin 来源拒绝校验,联调结束后恢复。
|
|
|
+ // if ($origin !== '' && !in_array($origin, $origins, true)) {
|
|
|
+ // $response = ApiResponse::error($request, new ApiException(40301, '不允许的访问来源', 403));
|
|
|
+ // }
|
|
|
+ if ($request->method() === 'OPTIONS') {
|
|
|
$response = new \support\Response(204);
|
|
|
} elseif (strlen($request->rawBody()) > Input::bodyLimit($request)) {
|
|
|
$response = ApiResponse::error($request, new ApiException(41301, '请求内容过大', 413));
|