常见的 https http 请求资源问题

关于https 导致资源问题被不同岗位的同事问过很多次。

一、图片链接加载失败或下载资源失败。

报错信息:Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure image '<URL>'. This request has been blocked; the content must be served over HTTPS.

意思是:- “Mixed Content”问题,在 https 网站中发起的 http 请求被禁止,这是因为 chrome 提高了用户安全策略,保护用户免受不安全下载的侵害(点击这里查看 chrome 文档 Protecting users from insecure downloads)

注意:https 协议的网站中不允许存在 http 协议的请求

http 协议的网站中允许访问 https 协议的资源

二、一般情况都是Nginx里解决

在nginx可通过在server或location后添加配置

#解决https请求http资源不可用的情况

add_header Content-Security-Policy "upgrade-insecure-requests;connect-src *";

扫描二维码关注公众号,回复: 15177839 查看本文章

欢迎大神批评指正~~

猜你喜欢

转载自blog.csdn.net/qq_35404844/article/details/129553998
今日推荐