V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
123abcdf11345
V2EX  ›  问与答

http 协议网页 html 中 http 协议的 img 资源自动使用 https 连接

  •  
  •   123abcdf11345 · 2021-06-30 20:11:15 +08:00 · 734 次点击
    这是一个创建于 1024 天前的主题,其中的信息可能已经有所发展或是发生改变。

    本人今天在扒一个网页时把 IMG 资源的链接没变,直接请求原站(没有防盗链),但是在浏览器请求时自动使用了 https 协议请求原站,原站的 https 存在安全问题,所以 F12 直接全部失败了 奇怪的点如下 ①index.html 中写死了使用 http 协议 ②最开始请求的 css,js 是用的 http,但是 4 次请求后就转用 https 了(同一域名) ③我的站点已关闭强制 https,原站根本不支持 https(证书配置错误)

    网站 index.html 源码

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <meta name="filetype" content="0">
    <meta name="publishedtype" content="1">
    <meta name="pagetype" content="2">
    <meta name="catalogs" content="52003">
    <link rel="shortcut icon" href="/images/favicon.ico" type="image/x-icon" />
    <title>奋斗百年路 启航新征程---热烈庆祝中国***成立 100 周年</title>
    <link rel="stylesheet" href="http://images1.wenming.cn/web_wenming/images/master2017.css" /><!--全网通用样式-->
    <link rel="stylesheet" href="http://images.wenming.cn/web_wenming/images/2017public-tyHB.css" /><!--全网通用头部底部样式-->
    <script src="http://images1.wenming.cn/web_wenming/images/public-jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="http://images.wenming.cn/web_wenming/images/jquery.superslide.tab.2.1.1.js"></script>
    <link rel="stylesheet" href="http://images1.wenming.cn/web_wenming/images/nanoscroll.css" />
    <script type="text/javascript" src="http://images1.wenming.cn/web_wenming/images/nanoscroll.js"></script>
    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
    <link href="http://images.wenming.cn/web_wenming/images/rlqzxzgcl20210520.css" rel="stylesheet" />
    <style type="text/css">
    	.tx-img{top: -8px;}
    	@media (min-width: 1366px){.box-sum { font-size: 18px;}.pxp-list .ydh-pic img{width: 275px;height: 185px;}}
    	@media (max-width: 980px){body,.nav {width: 1024px;}#subnav{display: none;}}
    .foucua03 .num01{width:150px;right:0;left:auto;}
    .foucua03 .num01 ul li{float:left;}
    </style>
    </head>
    <body>
    ---中间略去---
    <li>
    					<div class="scr-img">
    					<a href="http://www.wenming.cn/specials/100/sflrw/ymh/ggkfhshzyxdhjssq/202106/t20210607_6076085.shtml" target="_blank"><img src="http://images.wenming.cn/web_wenming/specials/100/sflrw/ymh/ggkfhshzyxdhjssq/202106/W020210608393726149826.JPG" alt="XxjpsgC007346_20210607_PEPFN0A001.JPG" title='' /></a>
    					</div>
    				<div class="text_js"><a href="http://www.wenming.cn/specials/100/sflrw/ymh/ggkfhshzyxdhjssq/202106/t20210607_6076085.shtml" target="_blank">苏宁:献身***的模范**</a></div>
    		    	</li>
    ----下略----
    </body>
    </html>
    

    上面代码中 http://images.wenming.cn/web_wenming/specials/100/sflrw/ymh/ggkfhshzyxdhjssq/202106/W020210608393726149826.JPG" alt="XxjpsgC007346_20210607_PEPFN0A001.JPG 会自动用 https 访问进而出错 最后一次 http 的传输 报错 一个使用 https 的传输

    2 条回复    2021-07-02 17:05:40 +08:00
    also24
        1
    also24  
       2021-06-30 20:24:50 +08:00   ❤️ 1
    <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
    123abcdf11345
        2
    123abcdf11345  
    OP
       2021-07-02 17:05:40 +08:00
    @also24 谢谢,问题已解决!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2874 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 03:58 · PVG 11:58 · LAX 20:58 · JFK 23:58
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.