Guide: use the laravel framework to return the error page when using Ajax for image upload request, and prompt 419 unknown status solution
419 unknown status has three solutions:
First, comment out CSRF validation in kernel.php, which is not recommended
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
// \Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
// \App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
// \Silber\PageCache\Middleware\CacheResponse::class,
// \App\Http\Middleware\VistLog::class
],
Second: write the interface to route/API. PHP
The third method is to add in the request parameters when uploading the request_ Token parameter
t'_token':'{{csrf_token()}}'
Similar Posts:
- [Django CSRF tutorial] solve the problem of forbidden (403) CSRF verification failed. Request aborted
- Django @csrf_exempt Cannot work in class view (Django @csrf_exempt not working in class View)
- Forbidden (CSRF token missing or incorrect.):
- [Solved] Forbidden (403) CSRF verification failed. Request aborted.
- Error encountered in Django: forbidden CSRF cookie not set
- [Solved] Call to undefined method Illuminate\\Support\\Facades\\Request::input()”
- CSRF verification failed. Request aborted [How to Solve]
- Django admin Error: ‘WSGIRequest’ object has no attribute ‘user’
- Django logs detailed error reporting information
- Hyperf captures PHP error levels, such as notice, warning and error, and returns them to the front-end