In my application, Laravel 5 randomly sends 500 internal server errors to ajax requests (for example, for ten 200 OK requests, one 500 Internal Server Error request). The CSRF icon is configured correctly:
$(function() { $.ajaxSetup({ timeout: 3000, headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); });
Here's what Laravel says

How can I fix this or catch the place in the code where the problem is?
source share