How to disable CSRF Token in Laravel and why we have to disable it?

前端 未结 7 1347
攒了一身酷
攒了一身酷 2020-11-30 06:39

I want to see how I can disable CSRF token in Laravel and where I have to disable it. Is this good to disable it or not?

7条回答
  •  生来不讨喜
    2020-11-30 06:58

    In laravel 7. Open file \App\Http\Middleware\VerifyCsrfToken.php

    Disable for all routes

    protected $except = [
        '*',
    ];
    

    Disable for some routes

     protected $except = [
        'mobile/*',
        'news/articles',
    ];
    

    I searched for a long time how to disable CSRF completely, there are many identical examples but they do not help

提交回复
热议问题