laravel Pit notes

Pit 1: 419

Description: Sign of the times reported 419

solution:

1.meta head token increase

<meta name="csrf-token" content="{{ csrf_token() }}" />

2. The increase in token form submission

  2.1{ csrf_field() }}

  2.2 <input type="hidden" name="_token" value="{{ csrf_token() }}">

3.js header token increase

.ajaxSetup $ ({ 
headers: { 'X---CSRF the TOKEN': '{{csrf_token ()}}'}
});

above, if neither of these solutions, the need to pay attention to whether the current domain cdn acceleration, because acceleration cdn will cache the current page, it will lead to {{csrf_token ()}} value expires, which would report 419 errors every time!
 

Guess you like

Origin www.cnblogs.com/jenkin1991/p/11095666.html