title: HTTP OPTIONS error in Phil Sturgeon's Codeigniter Restserver and Backbone.js
body: <p>My <code>backbone.js</code> application throwing an HTTP OPTIONS not found error when I try to save a model to my restful web service that's located on another host/URL.</p>
  <p>Based on my research, I gathered from this <a href="https://stackoverflow.com/questions/13727696/backbonejs-cors-and-save-method">post</a> that :</p>
  <blockquote>
  <p>a request would constantly send an OPTIONS http request header, and not trigger the POST request at all.</p>
  <p>Apparently CORS with requests that will &quot;cause side-effects on user data&quot; will make your browser &quot;preflight&quot; the request with the OPTIONS request header to check for approval, before actually sending your intended HTTP request method.</p>
  </blockquote>
  <p>I tried to get around this by:</p>
  <ul>
  <li>Settting emulateHTTP in Backbone to true.</li>
  </ul>
  <blockquote>
  <p>Backbone.emulateHTTP = true;</p>
  </blockquote>
  <ul>
  <li><p>I also allowed allowed all CORS and CSRF options in the header.</p>
  <p>header('Access-Control-Allow-Origin: *');<br />
  header(&quot;Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept&quot;);
  header(&quot;Access-Control-Allow-Methods: GET, POST, OPTIONS&quot;);</p>
  </li>
  </ul>
  <p>The application crashed when the <code>Backbone.emulateHTTP</code> line of code was introduced.</p>
  <p>Is there a way to respond to OPTIONS request in CodeIgniter RESTServer and are there any other alternatives to allow either disable this request from talking place?</p>
  <hr />
  <p>I found <a href="https://github.com/clockworkgeek/codeigniter-restserver-extra-verbs" rel="noreferrer">this on Github</a> as one solution. I am not sure if I should use it as it seems a bit outdated.</p>