Javascript SPA站点CORS问题的身份验证

Javascript SPA站点CORS问题的身份验证,javascript,cors,identityserver3,Javascript,Cors,Identityserver3,我有一个asp core angular 2 SPA网站,该网站通过oidc客户端到IdenityServer进行身份验证 我从外面试试spa认证 模拟spa站点运行的不同域http://localhost:5000在http://localhost:7890 在IdentityServer中,我向客户端配置中添加了允许的corsorigins AllowedCorsOrigins = new List<string> { "http://localhost:5000" }

我有一个asp core angular 2 SPA网站,该网站通过oidc客户端到IdenityServer进行身份验证

我从外面试试spa认证

模拟spa站点运行的不同域
http://localhost:5000
http://localhost:7890

在IdentityServer中,我向客户端配置中添加了
允许的corsorigins

AllowedCorsOrigins = new List<string>
{
     "http://localhost:5000"
}
AllowedCorsOrigins=新列表
{
"http://localhost:5000"
}
但当我触发重定向时,仍然会遇到跨域问题

无法加载XMLHttpRequest . 请求的服务器上不存在“Access Control Allow Origin”标头 资源。因此,不允许使用源“” 通道响应的HTTP状态代码为404

我错过了什么

响应的HTTP状态代码为404

这可能是错误消息中最重要的部分。您已经启用了CORS,但可能只针对实际存在的页面


你的URL搞错了。

是的。我没有完全意识到这一点。子部分“identity server”不是identity server url的一部分。这就解决了问题