Sencha Touch 和 CORS 支持(不通过 JSOP)
我正在尝试对名为 parse 和 sencha touch 的经过身份验证的 api 进行 ajax 调用。 我目前正在使用此 git 代码 https://www.parse.com/ 进行实现docs/rest#queries-basic / 实施视频 http://vimeo.com/28821052
I尝试发出请求时遇到此问题:
Origin http://127.0.0.1:8888 is not allowed by Access-Control-Allow-Origin.
我尝试像这样设置正确的标头,但没有骰子。
'Access-Control-Allow-Origin' : 'http://127.0.0.1:8888'
'Access-Control-Allow-Credentials' : 'true'
这里会出什么问题吗?
I am trying to make an ajax call to an authenticated api called parse and sencha touch.
I am currently working on an implementation using this git code https://www.parse.com/docs/rest#queries-basic / Video of Implementation http://vimeo.com/28821052
I get this issue when trying to make the request:
Origin http://127.0.0.1:8888 is not allowed by Access-Control-Allow-Origin.
Ive tried to set the correct headers like so but no dice.
'Access-Control-Allow-Origin' : 'http://127.0.0.1:8888'
'Access-Control-Allow-Credentials' : 'true'
What would be going wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些访问控制标头仅在由 API(而非客户端)发送时才起作用。毕竟,需要保护 API 免受客户端攻击,而不是相反。
除非 parse API 更改其标头,否则您必须使用 JSONP 或服务器端代理等技术。
Those access control headers only work when they are sent by the API, not the client. After all, it's the API that needs to be protected from the client, not the other way around.
Unless the parse API changes their headers, you'll have to use techniques like JSONP or a server-side proxy.