追番页面图片加载失败
kengwang opened this issue · comments
问题出处:
追番页面 (对,我自己提个Issue)
实际行为描述:
番剧图片无法加载,全是过渡 gif
预期的行为:
番剧图片正常加载,过渡GIF一会儿就没了,之后出现番剧图片
复现步骤:
使用非HTTPS网站打开追番页面.所有图片全部403 Forbidden
配置与环境:
- 问题页面:http://t-blog.tysv.top/bangumi
- 主题版本:Dev 1.4.0 - 1.4.1
- 使用的插件:主题内置追番模板
- 浏览器:Chrome 80.0.3987.132(正式版本) (64 位)
补充信息:
这个Bug主要是由于Bilibili设置了防盗链,检测到Reffer不对时就会停止信息传输并且返回403. 而HTTPS似乎没有传输Header中的Reffer(见图片)
所以bilibili会以为我们直接拖出来访问(下载),会同意请求
为什么发这个Issue?免得自己忘了233.
目前可能的解决方法就是img禁止传reffer
预计3天内提交下个版本代码(最近有个大型项目在搞)
感谢 @moyi 提交的问题
由于Chrome的缓存机制,如要查看测试页面,请先清理页面缓存
https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/img
referrerpolicy
A string indicating which referrer to use when fetching the resource:
no-referrer: The Referer header will not be sent.
no-referrer-when-downgrade: No Referer header is sent when navigating to an origin without HTTPS. This is the default if no policy is otherwise specified.
origin: The Referer header will include the page's origin (scheme, host, and port).
origin-when-cross-origin: Navigating to other origins will limit the included referral data to the scheme, host, and port, while navigating from the same origin will include the full path and query string.
unsafe-url: The Referer header will always include the origin, path and query string, but not the fragment, password, or username. This is unsafe because it can leak information from TLS-protected resources to insecure origins.
贴一下解决方案,免得又去找
目前只能牺牲懒加载了,懒加载和referrerpolicy属性不兼容
搞个懒加载开关吧,虽然不太好搞