跨源资源共享 - CORS(Cross Origin Resource Sharing - CORS)

498 IT屋

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.

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



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



<


解决方案

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



 访问控制允许原产地:* 


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


本文地址:IT屋 » 跨源资源共享 - CORS