Last active
July 2, 2018 20:24
-
-
Save vzool/87b13a3d0c8e168a3587 to your computer and use it in GitHub Desktop.
CodeIgniter: ignore CSRF in many URIs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Put those lines in application/config/config.php | |
$csrf_ignore = [ | |
'/page1.html', | |
'/about.html' | |
]; | |
$is_csrf_condition_met = true; | |
foreach($csrf_ignore as $ci){ | |
if (strpos($_SERVER["REQUEST_URI"], $ci) !== FALSE) { | |
$is_csrf_condition_met = false; | |
break; | |
} | |
} | |
$config['csrf_protection'] = $is_csrf_condition_met; |
Hello,
this is for controller function, i want to ignore API file means web service controller file all functions.
Like :- $config['csrf_exclude_uris'] = array('myapifilename/*');
please help me for this.
For anyone looking at targeting list of links which can be grouped in arrays see my answer HERE
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to remove like index/[:num] but its not working