跨源资源共享 - CORS [英] Cross Origin Resource Sharing - CORS

查看:630
本文介绍了跨源资源共享 - CORS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从一个服务器到另一个服务器进行跨源调用。无法得到它的工作。
这样做了一个测试页,其中包含与此示例一起使用的代码
http://arunranga.com/examples/access-control/preflightInvocation.html



这是我的示例页面,具有相同的代码:
< a href =http://webcosmo.com/test.html =nofollow> http://webcosmo.com/test.html


解决方案

p>您的资源缺少 Access-Control-Allow-Origin 标头。因此CORS不会使用它。尝试将其添加到响应标头中:

 访问控制允许原产地:* 

阅读此以了解有关 Access-Control-Allow-Origin 标头的更多信息。


Trying to make a cross origin call from one server to another server. Cant get it working. So made a test page with the code that works with this example http://arunranga.com/examples/access-control/preflightInvocation.html

Here is my example page with same code: http://webcosmo.com/test.html

However I am getting 403 forbidden error.

Anybody?

解决方案

Your resource is missing Access-Control-Allow-Origin header. Thus CORS won't work with it. Try adding this to your response headers:

Access-Control-Allow-Origin: *

Read this for more info about Access-Control-Allow-Origin header.

这篇关于跨源资源共享 - CORS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆