【发布时间】:2017-11-29 14:54:35
【问题描述】:
我目前正在处理一个显示为
的错误Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 404.
请求在我的服务器上运行良好,但在我的客户端上中断。我最近发现了这个文件,public/crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
<!-- Most restrictive policy: -->
<!-- <site-control permitted-cross-domain-policies="none"/> -->
<!-- Least restrictive policy: -->
<site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/>
</cross-domain-policy>
虽然这看起来像是我一直在寻找的解决方法,但我仍然遇到同样的错误。没有像这个服务器端这样的问题,我的客户端现在基本上与我的服务器的配置相匹配。为什么此政策无法解决错误?我是否需要进一步配置此策略以接受所需的标头?
更新:Here 是我尝试发出跨域请求时客户端错误和服务器输出的概要
【问题讨论】:
标签: xml ember.js cross-domain access-control