我在HttpClient上遇到“http ...”url的get请求,服务器将请求从http重定向到https .

HttpClient产生错误:无法加载http://localhost:8080/api:重定向

'http://localhost:8080/api ' to ' https://localhost:1515/api/ ' has been blocked by CORS policy: No ' Access-Control-Allow-Origin ' header is present on the requested resource. Origin ' http://localhost:8100'因此不允许访问 .

我已经配置我的api服务器以允许两个来源http://localhost:8080https://localhost:1515并且当使用浏览器访问http://localhost:8080时,我正确地重定向到https://localhost:1515并且我没有CORS问题 .