mixed-content
它能做什么
这项技能检查 HTTPS 网站中是否有通过纯 HTTP 加载的脚本、图片、样式表和框架。适用于希望安全页面保持安全的网站所有者和开发者。
适用场景
- ✓当你请智能体检查安全网站中的不安全资源链接的时候。
- ✓当浏览器就 HTTPS 页面的混合内容发出警告,或拦截了某个脚本的时候。
- ✓当你把网站迁移到 HTTPS,并想找出仍然残留的 http 地址的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/mixed-content/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的浏览器提示 HTTPS 网站上有部分内容不安全。请帮我找出并修复这些链接。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会扫描页面源代码、网络请求和 CSS 中的纯 HTTP 地址,并将其替换为 HTTPS 版本。它还可以添加安全策略,把仍然残留的地址升级为 HTTPS。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Avoid mixed content on HTTPS pages
Active mixed content (scripts loaded over HTTP into an HTTPS page) gives network attackers the ability to execute arbitrary JavaScript on your page — the same power as XSS, despite the page itself being served over HTTPS.
Quick Reference
- Active mixed content (scripts, iframes, stylesheets) is blocked outright by all modern browsers
- Passive mixed content (images, audio, video) triggers a security warning and may be upgraded or blocked
- Use
upgrade-insecure-requestsCSP directive to automatically upgrade HTTP sub-resources to HTTPS - Audit all hardcoded
http://URLs in HTML, CSS, and JavaScript - The
Content-Security-Policy: upgrade-insecure-requestsdirective is the most practical fix for legacy content
Check
Scan the page source and network requests for any HTTP resources loaded on an HTTPS page. Check <script src>, <img src>, <link href>, <iframe src>, and CSS url() values for http:// URLs. Also check the Content-Security-Policy header for the upgrade-insecure-requests directive.
Fix
Replace all http:// resource URLs with https:// equivalents. If the resource provider does not support HTTPS, host the resource yourself or find an alternative. Add Content-Security-Policy: upgrade-insecure-requests as a safety net for any remaining HTTP URLs.
Explain
Explain the difference between active and passive mixed content, why active mixed content is blocked by browsers, and how the upgrade-insecure-requests CSP directive works.
Code Review
Review server config, headers, forms, and integration points related to Avoid mixed content on HTTPS pages. Flag exact responses, cookies, or browser behaviors that violate the rule, and verify them against the effective production-like response.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/security/mixed-content
常见问题
主动混合内容和被动混合内容有什么区别?
脚本等主动内容会被浏览器拦截,而图片等被动内容可能只会触发警告。
什么是 upgrade-insecure-requests?
它是一项内容安全策略设置,告诉浏览器改用 HTTPS 加载 HTTP 资源。
如果服务提供商不支持 HTTPS 怎么办?
这项技能建议自己托管该资源,或寻找替代方案。
详情
作者的原始描述
Use when reviewing an HTTPS page for resources (scripts, images, stylesheets, iframes) that are loaded over plain HTTP.
热度
- GitHub 星标
- 75k
- 排名
- #2939
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。