Access-Control-Allow-Origin无法正常工作 - AngularJS cakePHP 3.0

时间:2016-03-22 08:54:00

标签: angularjs http-headers cakephp-3.0 allow-same-origin

我正在使用以PHP 3.0编写的Web服务处理angularJS应用程序。

在实施CSRF的过程中,我遇到了一个问题,即设置cookie'标题未被阅读。经过stackoverflow上的几篇文章后,我添加了“访问控制 - 允许 - 来源”和#39;和'访问控制 - 允许 - 凭据'是真实的,并且有过#Credentials'客户端是真的。

 $this->response->header('Access-Control-Allow-Headers', 'Content-Type');
 $this->response->header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
 $this->response->header('Access-Control-Allow-Origin', 'http://localhost:8080');
 $this->response->header('Access-Control-Allow-Credentials', 'true');

但是这没用。所以我尝试更改“访问控制 - 允许 - 来源”#39;从localhost到#34; http://google.com"并在服务器上托管代码。

这样做我期待在浏览器上抛出错误但没有任何反应。服务电话embedded here的屏幕截图。

0 个答案:

没有答案