Access Control Origin在htaccess和php文件中,但仍然被阻止

时间:2014-11-24 18:46:50

标签: php .htaccess cors

即使我在文件的最顶部和htaccess文件中明确包含了标题,我仍然会收到无标题错误

header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With');
header('Access-Control-Allow-Credentials: true');

和htaccess

Header set Access-Control-Allow-Origin "*"

Chrome给了我以下错误:

XMLHttpRequest cannot load http://someurl.php. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.12.29' is therefore not allowed access. The response had HTTP status code 503. 

我不知道我怎么能这样做?任何想法?

0 个答案:

没有答案