Tag Archives: 419 unknown status

[How to Solve] Laravel Ajax request error: 419 unknown status

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()}}'