【踩坑】前端发起请求报错
前言
前端通过Fetch发起请求,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页面
解决问题
- 如果请求的目标地址支持HTTPS,则将HTTP改为HTTPS
- 如果请求的目标地址不支持HTTPS,则通过Nginx反向代理解决