The problem only occurs on Safari for Mac. I'm loading clean json data files, with the following:
$.ajax({
url : url,
type : 'POST',
dataType : 'json',
contentType : 'application/json; charset=utf-8',
crossdomain: true,
context : contextObj.context,
success : function(data) {
// Irrelevant
callBackHandler.call(contextObj.context, event);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status);
console.log(thrownError);
}
});
My CORS enabled server has the following:
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, POST, OPTIONS"
Header set Access-Control-Allow-Headers "Content-Type, If-Modified-Since, If-None-Match, *"
Header set Access-Control-Max-Age "3600"
I captured the request headers and the only difference I see is in the following. To be clear, the following is included in the failed request, while the next refresh does NOT include the following. Hence the addition of items to the Access-Control-Allow-Headers:
If-Modified-Since: Fri, 08 Mar 2013 15:57:07 GMT
If-None-Match: "6801d-c550-4d76be008fac0"
Is this a server configuration problem, jQuery usage, or something else? It's odd to me that Safari consistently changes the headers on every other refresh.