【踩坑】前端发起HTTP请求报错

前言

前端发起HTTP请求报错
Safari报错:The page at https:// was not allowed to display insecure content from http://.
Chrome报错:The page at 'https://' was loaded over HTTPS, but requested an insecure resource 'http://'. This request has been blocked; the content must be served over HTTPS.

原因

  • 在HTTPS页面请求了HTTP页面

解决问题

  • http://改为https://

可能需要配置SSL证书

完成

参考文献

腾讯云开发者社区——DannyHoo