html – CORS HEADERS仅在预检或每个请求中出现

html – CORS HEADERS仅在预检或每个请求中出现,第1张

概述我不清楚CORS头(Access-Control-Allow-Origin等)是否只应出现在预检请求(OPTIONS方法)上,或者还存在于资源头(我正在尝试使用XHR进行POST)中 我问这个是因为我安装了一个python插件,它只通过向OPTIONS方法(预检)添加CORS头来处理cors,但是没有添加到请求的资源,这种方法不解决chrome和firefox上的cors问题,返回消息喜欢 Cro @H_403_0@ @H_403_0@ 我不清楚CORS头(Access-Control-Allow-Origin等)是否只应出现在预检请求(OPTIONS方法)上,或者还存在于资源头(我正在尝试使用XHR进行POST)中

我问这个是因为我安装了一个python插件,它只通过向OPTIONS方法(预检)添加CORS头来处理cors,但是没有添加到请求的资源,这种方法不解决Chrome和firefox上的cors问题,返回消息喜欢

Cross-Origin Request Blocked: The Same Origin Policy disallows reading
the remote resource at [URL]. This can be fixed by
moving the resource to the same domain or enabling CORS.

编辑:

我还在http://www.html5rocks.com/en/tutorials/cors/上找到了更多信息,其中说:

Access-Control-Allow-Origin (required) – This header must be included
in all valID CORS responses; omitting the header will cause the CORS
request to fail. The value of the header can either echo the Origin
request header (as in the example above),or be a ‘*’ to allow
requests from any origin. If you’d like any site to be able to access
your data,using ‘*’ is fine. But if you’d like finer control over who
can access your data,use an actual value in the header.

解决方法 他们必须出现在两个回复中.

the preflight rules的第3步要求浏览器遵循正常的make a request steps.

@H_403_0@ 总结

以上是内存溢出为你收集整理的html – CORS HEADERS仅在预检或每个请求中出现全部内容,希望文章能够帮你解决html – CORS HEADERS仅在预检或每个请求中出现所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1077805.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存