使用ServiceStacks JsonServiceClient时出现Cors配置问题 [英] Cors configuration issues when using ServiceStacks JsonServiceClient

查看:110
本文介绍了使用ServiceStacks JsonServiceClient时出现Cors配置问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用ServiceStack的JsonServiceClient将数据发布到我的API时遇到问题.

I have issues when trying to Post data to my API using ServiceStack's JsonServiceClient.

我在控制台中收到以下错误消息

I get the following error message in the console

可通过以下网址获取信息:< https://192.168.10.191:5001/json/reply/来自来源" http://192.168.10.191:5000 的CreateEquipment "已被CORS阻止政策:飞行前响应中Access-Control-Allow-Headers不允许请求标头字段标头.

Access to fetch at 'https://192.168.10.191:5001/json/reply/CreateEquipment' from origin 'http://192.168.10.191:5000' has been blocked by CORS policy: Request header field headers is not allowed by Access-Control-Allow-Headers in preflight response.

我已将192.168.10.191:5000添加到白名单中.

I have added 192.168.10.191:5000 to the Whitelist.

我可以在网络标签中看到它尝试访问" https://192.168. 10.191:5001/json/reply/CreateEquipment ",但当我使用提琴手捕获流量时却什么也没显示.

I can see in the network tab that it tries to access "https://192.168.10.191:5001/json/reply/CreateEquipment" but nothing is showing when I capture the traffic using fiddler.

我已附上标题的图像. https://i.stack.imgur.com/hUfII.png

I have attached an image of the headers. https://i.stack.imgur.com/hUfII.png

推荐答案

您在端口 5001 上请求 https 资源,但是您的来源白名单返回了 http 资源在 5000 上,它们需要匹配.

Your requesting a https resource at port 5001 but your origin white list returns a http resource on 5000, they need to match.

这篇关于使用ServiceStacks JsonServiceClient时出现Cors配置问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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