http-to-https
它能做什么
这项技能检查 Web 服务器是否将普通 HTTP 访问发送到安全的 HTTPS 地址。适用于运营网站的网站所有者和开发者。
适用场景
- ✓当访客在输入域名时没有带 https,并进入了不安全版本的时候。
- ✓当旧链接仍指向普通 http 地址的时候。
- ✓当你设置新服务器或新托管服务商的时候。
技能链接
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/http-to-https/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请确保我的网站会把所有 http 访问重定向到 https。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会检查普通地址是否以 301 重定向响应到对应的 HTTPS 地址,并保留完整路径。它会建议在服务器或 CDN 层面进行设置,并通过命令行请求进行测试。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Redirect HTTP to HTTPS
Without an HTTP-to-HTTPS redirect, users who type the domain without https:// or follow old links land on the insecure version of the site, exposing session cookies and form data to network attackers.
Quick Reference
- Redirect
http://example.comtohttps://example.comwith HTTP 301 (permanent redirect) - Preserve the full path and query string in the redirect:
https://$host$request_uri - Use 301 (not 302) so browsers and search engines cache the redirect and future requests go directly to HTTPS
- Configure redirects at the server/CDN level — never rely on client-side JavaScript for security redirects
- After validating HTTPS works, add HSTS to eliminate future HTTP requests entirely
Check
Test whether http://example.com redirects to https://example.com with a 301 status code. Check that the full URL path and query string are preserved in the redirect Location header.
Fix
Configure the web server to redirect all HTTP requests to HTTPS with a 301 status code, preserving the full request path. Verify the redirect with curl -I http://example.com.
Explain
Explain why redirecting HTTP to HTTPS is necessary, the difference between 301 and 302 redirects, and how HSTS can eliminate the redirect for returning users.
Code Review
Review server config, headers, forms, and integration points related to Redirect HTTP to HTTPS. 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/http-to-https
常见问题
为什么使用 301 而不是 302?
这项技能指出,301 是永久性的,因此浏览器和搜索引擎会缓存它,并在以后直接访问 HTTPS。
重定向应该用 JavaScript 实现吗?
不应该。这项技能指出,安全重定向应在服务器或 CDN 上配置,而不是在客户端代码中。
设置重定向之后还需要做什么?
这项技能建议添加 HSTS,以阻止之后的普通 HTTP 请求。
详情
作者的原始描述
Use when checking whether a web server is configured to redirect all HTTP traffic to HTTPS.
热度
- GitHub 星标
- 75k
- 排名
- #2876
- 许可证
- MIT
- 更新时间
- 2026/10/31
评论
- …
同一仓库的更多技能
frontendchecklist
75k使用命令行工具,依据 380 多条关于无障碍、速度、SEO 和安全的规则,检查前端代码和线上页面。
frontend-checklist-global
75k依据全部 386 条 Front-End Checklist 规则审查前端项目,并为发现的每个问题给出具体修复方法。
404-page
75k检查你的页面缺失提示是否提供有用的链接,并返回真正的 404 状态,帮助迷路的访客找到方向。
about-page
75k审查你的网站是否有清晰的关于页面,说明由谁运营,以建立访客和搜索引擎的信任。