From a RESTful Backbone application, I\'m doing CORS requests from mydomain.com
to myExtdomain.com
.
I did set up CORS on my
For me, the solution was to add Access-Control-Allow-Credentials: true
in response headers of server side: this is the symmetric of setting request.withCredentials = true;
for a XMLHttpRequest
object on client side.
Adding the Cache-Control: no-cache
header to all my API calls Responses (on myExtdomain.com
) solved my problem:
Access-Control-Allow-Origin: *
Content-Type: application/json
Cache-Control: no-cache
For some reason, Firefox was caching my API calls, and when cached, FF was not able to parse the JSON again.. Ending up in an empty response body or whatever error that was..
Now I remember this is not the first time I have to force no-cache
with Firefox..
Again, everything was working fine with Chrome, Chrome does not need the Cache-Control: no-cache
header.
If someone know about this difference between FF and Chrome (default settings??), I'd be curious to no more about it.
Hope this will save some time to somebody.