OK, I get it. I was looking for a simple and quick fix, because I only need cross-domain requests for development purposes. Turns out I just needed to install both
header("Access-Control-Allow-Origin: http://foo.bar.no:9294"); header("Access-Control-Allow-Credentials: true");
In my PHP script on Apache. Then in my JavaScript code:
# Set jQuery ajax to use 'withCredentials' globally $.ajaxSetup({ xhrFields: { withCredentials: true } });
And this trick
Hubro
source share