Here's a weird situation I can't figure out.
I'm making a cross-domain AJAX request on my site, from its http
domain to its https
one. I'm doing this via buttons on two different pages. On one page, the request works fine, and I can see from Firebug that my session cookies are sent across to the server properly. On the other page - under the same domain and URL structure - no cookies are sent.
E.g. working from http://www.example.com/en/apples
But not working from http://www.example.com/en/oranges
The code is as follows:
var ajaxUrl = "https://www.example.com/en/controller/add/bananas/";
jQuery.ajax({
type: "GET",
url: ajaxUrl,
xhrFields: {
withCredentials: true
},
crossDomain: true,
success: function(data) {
console.log("Yay");
}
}
);
My https
site responds with:
Header add Access-Control-Allow-Origin "http://www.example.com"
Header add Access-Control-Allow-Credentials "true"
I know it works because it works on /apples
but the exact same code doesn't work on /oranges
! What's going on here?