I have enabled CORS in Apache, here are the headings I am seeing when loading the site:
HTTP/1.1 200 OK Access-Control-Allow-Methods: GET, POST, OPTIONS Access-Control-Allow-Origin: * Cache-Control: no-cache, must-revalidate, max-age=0, max-age=0, no-cache Content-Encoding: gzip Content-Type: text/html; charset=UTF-8 Date: Wed, 20 Aug 2014 17:05:00 GMT Expires: Wed, 11 Jan 1984 05:00:00 GMT Link: <http://test.example.com/?p=7>; rel=shortlink Pragma: no-cache Server: Apache Vary: Accept-Encoding X-Frame-Options: SAMEORIGIN X-Mod-Pagespeed: 1.7.30.4- X-Pingback: http://test.example.com/xmlrpc.php X-Powered-By: PHP/5.4.28 Content-Length: 6757 Connection: keep-alive
However when I reload the page, I get the following JS Error:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://api.example.com/?x=1. This can be fixed by moving the resource to the same domain or enabling CORS.
Any ideas why this would be failing? I am trying to access api.example.com from test.example.com