【报错解决】【Vue】与后端交互时,http与https跨域问题

问题


xhr.js:220 Mixed Content: The page at 'https://xxx' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://xxx'. This request has been blocked; the content must be served over HTTPS.

场景

Vue前端,Java后端,网站开启了强制https
上传项目后发生了以上报错。

解决方法

在index.html文件中添加
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

注意

我后端早就写了对跨域问题的处理的

posted @ 2022-06-06 14:59  萌狼蓝天  阅读(2826)  评论(0编辑  收藏  举报