You have to find a pattern that match every routes except this particular route. Anyway, why do you want to disable csrf protection on one route ?
Nov 9, 2014
4
Level 15
CSRF filter on all post requests except one?
i have this defined in routes file.
Route::when('*','csrf',['post']);
Now, how can i disable csrf on a particular post route?
Level 65
Not sure if there's an ->except() for a Route::when() but you could try this. What about making a new one to filter out certain? Or of course add it onto the original csrf filter.
Route::filter('csrf2', function()
{
if ( ! Request::is('payment-return/*'))
{
if (Session::token() !== Input::get('_token'))
{
throw new Illuminate\Session\TokenMismatchException;
}
}
});
Route::when('*', 'csrf2', ['post']);
1 like
Please or to participate in this conversation.