如何绕过Allow-Access-Control-Origin?
如果有人有网络服务但没有设置标头Allow-Access-Control-Origin:*
那么我到底如何发出请求并获取资源?
http://www.random.org/clients/http/ 声明一个 Web 服务,可以调用如下: http://www.random.org/integers/?num=10&min=1&max=6&col=1&base=10&format=plain&rnd=new
当我尝试通过 XHR 访问它时,我遇到 Access-Control-Allow-Origin 不允许 Origin null。
我知道这是正常的,我只是想知道如果 API 的创建者没有正确设置这些标头,他们究竟希望我如何调用它?
或者它周围有什么吗?
if someone had a web-service but did not set header Allow-Access-Control-Origin:*
Then how exactly do I make the request and get the resource?
http://www.random.org/clients/http/ states a web service that can be called as follows: http://www.random.org/integers/?num=10&min=1&max=6&col=1&base=10&format=plain&rnd=new
When I tried to access it through XHR I had Origin null is not allowed by Access-Control-Allow-Origin.
I know this is normal, I just want to know how exactly did the creators of the API expect me to call it if they did not set those headers appropriately?
Or is there anyway around it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从您控制的机器(即您的服务器)而不是您不控制的机器(即访问者的浏览器)发出请求
Make the request from a machine you control (i.e. your server) and not one that you don't (i.e. your visitor's browser)