使用github部署打包后的vue2静态页面报错
Mixed Content: The page at 'https://rossweisseavalon.github.io/shopping-page/#/home' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://smart-shop.itheima.net/index.php?s=/api/page/detail&pa...'. This request has been blocked; the content must be served over HTTPS.
了解了一下应该是因为在https下请求了http的接口
貌似可以改后端的接口解决,但是接口不是我的,修改了dist文件下的index.html的<meta http-equiv="X-UA-Compatible" content="IE=edge">为<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">并且重新push在了远程仓库,但是不行
这是浏览器行为。
接口是别人的。你可以在你的服务器上nginx反向代理对方接口。否则没戏。