Я включил CORS в Apache, вот заголовки, которые я вижу при загрузке сайта:
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
Однако, когда я перезагружаю страницу, я получаю следующую ошибку JS:
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.
Есть идеи, почему это не работает? Я пытаюсь получить доступ к api.example.com с test.example.com
Мне пришлось добавить конфигурацию к серверам, с которых я запрашивал данные.