How to turn off CRSF protection for a route in Laravel ?

To turn off or diasble CRSF protection for specific routes in Laravel open “app/Http/Middleware/VerifyCsrfToken.php” file and add following code in it

//add this in your class
private $exceptUrls = ['controller/route1', 'controller/route2'];

//modify this function

public function handle($request, Closure $next)

 //add this condition
foreach($this->exceptUrls as $route) {

 if ($request->is($route)) {

  return $next($request);


return parent::handle($request, $next);}

Leave a Reply

Your email address will not be published. Required fields are marked *