I\'m developing a DJANGO + AngularJS application, where the angular part is not being served by django.
I set the angular $httpProvider as follows:
The 1.2.0 update wasn't sufficient for me when using Safari or Firefox (Chrome was working just fine all the time). The problem with Safari and Firefox was that the Django backend didn't send the csrf-cookie in the HTTP response.
What I had to do was add the @ensure_csrf_cookie decorator to my view function that builds up the page for Angularjs.
@ensure_csrf_token
def my_view(request):
...
and in the javascript file:
myApp.config(function($httpProvider) {
$httpProvider.defaults.xsrfCookieName = 'csrftoken';
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken';
}
At least for now I have no idea why Chrome works without it but the other browsers don't.