title: Angular 1.5 CORS
body: <p>I have an angular js client that makes requests to a server. My http provider (at <a href="http://localhost" rel="nofollow">http://localhost</a>) code looks like this:</p>
  
  <pre><code>angular.config(['$httpProvider', function ($httpProvider) {
      // Reset headers to avoid OPTIONS request:
      $httpProvider.defaults.headers.common  = {};
      $httpProvider.defaults.headers.post    = {};
      $httpProvider.defaults.headers.put     = {};
      $httpProvider.defaults.headers.patch   = {};
      $httpProvider.defaults.withCredentials = true;
  }]);
  </code></pre>
  
  <p>At the server side (at <a href="http://localhost:3000" rel="nofollow">http://localhost:3000</a> , so just the port is different), I return the headers back with a perl script in Mojolicious like this:</p>
  
  <pre><code># Set response headers so that we can send cross-domain requests
  $self-&gt;res-&gt;headers-&gt;header('Access-Control-Allow-Origin'      =&gt; $self-&gt;req-&gt;headers-&gt;header('origin'));
  $self-&gt;res-&gt;headers-&gt;header('Access-Control-Allow-Credentials' =&gt; 'true');
  $self-&gt;res-&gt;headers-&gt;header('Access-Control-Allow-Methods'     =&gt; 'GET, POST, OPTIONS');
  $self-&gt;res-&gt;headers-&gt;header('Access-Control-Allow-Headers'     =&gt; 'Content-Type, X-CSRF-Token');
  $self-&gt;res-&gt;headers-&gt;header('Access-Control-Max-Age'           =&gt; '1728000');
  </code></pre>
  
  <p>Now, this code works perfectly in Angular 1.2. However, when I try to upgrade to Angular 1.5, things stop working. When looking at my logs and firebug, the server is accessed, the right scripts are executed, the server returns the correct values, the browser (tested with both firefox and chrome) simply ignores everything that is sent back, including any error codes. The problem seems to happen with Angular 1.4 as well. </p>
  
  <p>Did something change in the meantime with Angular? Is there some extra code that needs to be run for it to accept Cross-Domain requests?</p>