AngularJS未检测访问控制允许来源的头? [英] AngularJS not detecting Access-Control-Allow-Origin header?

查看:134
本文介绍了AngularJS未检测访问控制允许来源的头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地运行虚拟主机的角度应用( http://foo.app:8000 )。它正在使用另一个本地虚拟主机( http://bar.app:8000 $ HTTP请求。后

I am running an angular app on a local virtualhost (http://foo.app:8000). It is making a request to another local VirtualHost (http://bar.app:8000) using $http.post.


$ http.post('http://bar.app:8000/mobile/reply',回复,{withCredentials:真});

在Chrome开发者工具的网络选项卡,当然我看到的选项请求,响应包括头:

In the Network tab of Chrome Developer Tools I of course see the OPTIONS request, and the response includes the header:

访问控制允许来源:http://foo.app:8000

不过,POST请求被取消,出现以下错误:

However, the POST request is cancelled with the following error:

无'访问控制允许来源标头的请求的资源present。因此出身http://foo.app:8000'是不允许访问。

有没有人遇到过这个?在访问控制允许来源头很清楚地包含在OPTIONS请求的响应,所以我不能为我的生命弄清楚为什么是POST作用于头部不见了。

Has anyone experienced this? The Access-Control-Allow-Origin header is very plainly included in the response of the OPTIONS request, so I can't for the life of me figure out why the POST is acting the header was missing.

访问控制允许的凭据也被设置为真正

推荐答案

它在Chrome浏览器本地开发的错误。尝试其他的浏览器。然后,它会工作。

It's a bug in chrome for local dev. Try other browser. Then it'll work.

这篇关于AngularJS未检测访问控制允许来源的头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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