在后端它可以工作,但是在前端x-ratelimit-remaining
头上却不会减少。也许有人知道是什么原因。谢谢。
Kernel.php
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'admin' => \App\Http\Middleware\admin::class,
];
api.php
if (Request()->header('Authorization')) {
Route::post('search', 'SearchController@search');//->middleware('throttle:30,1440', 'auth:api', 'admin');
} else {
Route::post('search', 'SearchController@search');//->middleware('throttle:3,1440');
}