angularjs 7 Access-Control-Allow-Origin 被 cors 策略阻止 [英] angularjs 7 Access-Control-Allow-Origin blocked by cors policy

查看:80
本文介绍了angularjs 7 Access-Control-Allow-Origin 被 cors 策略阻止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

访问 XMLHttpRequest 在
http://badamirchi.com/wldev/api/Services//SignIn
from origin
http://localhost:4200 已被 CORS 策略阻止:<块引用>

对预检请求的响应未通过访问控制检查:请求的资源上不存在Access-Control-Allow-Origin"标头.

以下是我遇到的问题.

解决方案

看来您需要设置更合适的 CORS 标头,或者您尝试访问的资源不允许 localhost 域访问.你有这个服务的 API 密钥设置吗?您可能需要将 localhost 添加到您批准的域中(Google AUTH 要求这样做)

Access to XMLHttpRequest at
http://badamirchi.com/wldev/api/Services//SignIn
from origin
http://localhost:4200 has been blocked by CORS policy:

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Below is the issue I am getting.

解决方案

It looks like eithr you need to set more appropriate CORS headers or the resource you are trying to access doesnt allow localhost domain access. Do you have an API key setup with this service? You may need to add localhost into your approved domains (Google AUTH requires this)

这篇关于angularjs 7 Access-Control-Allow-Origin 被 cors 策略阻止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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