Im using Laravel 7.4 Recently upgraded from 5.2 Did not experience any of this on 5.2.
Server Error 500 when VerifyCsrfToken is swiched off
I have been getting this error and to get rid of it I changed the following.
In VerifyCsrfToken.php I added the following to allow any route
protected $except = [
'*'
];
Also in Kernel.php I commented out this:
// \App\Http\Middleware\VerifyCsrfToken::class,
But I still get the dreaded { message: "Server Error" } Not very often, but it happens.
It always happens with the same items but the turnaround for those requests are about 180ms, so quite quick.
There are about 9 requests that go out at the same time and the respons always fails on the 7th or 9th one, never the 8th ( for some reason ).
Im using React 0.13 ( Im stuck on this version for now ) and Ajax. ( React 0.13 cant use Axios )
Before the changes above I had the following code in bootstrap.js
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content'),
'X-Requested-With': 'XMLHttpRequest'
}
});
and the following in my Start page:
<meta name="csrf-token" content="{{ csrf_token() }}">
But even with this I got { message: "Server Error" } very frequently.
Im not sure what other information I missed, but please can someone shed some light on this topic for me.
I could not run php artisan config:cache becasues of 2 files with incorrect namespaces. When I fixed that issue I was able to run that command and I dont get the Server Error or No application encryption key has been specified. anymore
Please or to participate in this conversation.