title: XSRF headers not being set in AngularJS
body: <p>I'm developing a DJANGO + AngularJS application, where the angular part is not being served by django.</p>
  
  <p>I set the angular <code>$httpProvider</code> as follows:</p>
  
  <pre><code>myApp = angular.module('myApp', [])
  
  myApp.config(['$httpProvider',
    function(provider){
      provider.defaults.xsrfCookieName = 'csrftoken';
      provider.defaults.xsrfHeaderName = 'X-CSRFToken';
  }
  </code></pre>
  
  <p>Then, before doing any POST, I do a GET which sets the cookie. I can confirm through Chrome that the cookie is set:</p>
  
  <pre><code>set-cookie:csrftoken=hg88ZZFEdLPnwDdN1eiNquA8YzTySdQO; expires=Tue, 19-Aug-2014 12:26:35 GMT; Max-Age=31449600; Path=/
  </code></pre>
  
  <p>(it's visible in resources/cookies/localhost in the Chrome developer tools)</p>
  
  <p>However when I do a POST, no <code>X-CSRFToken</code> header is being set</p>
  
  <p>this is the POST as recorded by Chrome:</p>
  
  <pre><code>POST /data/activities/search HTTP/1.1
  Host: localhost:14080
  Connection: keep-alive
  Content-Length: 2
  Accept: application/json, text/plain, */*
  Origin: http://localhost:14080
  X-Requested-With: XMLHttpRequest
  User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36
  Content-Type: application/json;charset=UTF-8
  Referer: http://localhost:14080/public/html/main.html?codekitCB=398694184.799418
  Accept-Encoding: gzip,deflate,sdch
  Accept-Language: en-US,en;q=0.8
  Cookie: csrftoken=hg88ZZFEdLPnwDdN1eiNquA8YzTySdQO
  </code></pre>
  
  <p>Why is no header being set? What else should I do to activate this functionality?</p>
  
  <p>(side note: if I manually pass the header in the $http() call, the POST request works fine.. therefore the problem is really the header not being set by AngularJS)</p>