title: CodeIgniter turn off CSRF outside controller
body: <p>I've just started using codeigniters in-built CSRF protection. It works fine, but there are a few third-party pages that I can't have it enabled on that exist outside CI's controllers and thus cannot be whitelisted.</p>
  
  <p>For example, CKFINDER. I have this in the configuration file so I can access my sessions .etc.:</p>
  
  <pre><code>$CI = require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'CI.php';
  </code></pre>
  
  <p>CI.php</p>
  
  <pre><code>ob_start();
  define('REQUEST', 'external');
  require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . "index.php"; //or wherever the directory is relative to your path
  ob_end_clean();
  return get_instance();
  </code></pre>
  
  <p>I've tried <code>$CI-&gt;config-&gt;set_item('csrf_protection', false);</code> and with a var dump it does appear as though the variable is set to false. However, CSRF protection from CI remains active. I'm not sure if you can't modify the master config array this way, or if something else is wrong.</p>
  
  <p>How can I turn off <code>csrf_protection</code> for pages outside CI's controller?</p>