mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 16:15:49 -06:00
[GH-ISSUE #2899] [Feature Request] HSTS support #2313
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#2313
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @donargreys on GitHub (Apr 18, 2022).
Original GitHub issue: https://github.com/fatedier/frp/issues/2899
Describe the feature request
HSTS 工作原理
通常,当您在 Web 浏览器中输入 URL 时,您会跳过协议部分。 例如,你输入的是 www.acunetix.com,而不是 http://www.acunetix.com。 在这种情况下,浏览器假设你想使用 HTTP 协议,所以它在这个阶段发出一个 HTTP 请求 到 www.acunetix.com,同时,Web Server 会返回 301 状态码将请求重定向到 HTTPS 站点。 接下来浏览器使用 HTTPS 连接到 www.acunetix.com。 这时 HSTS 安全策略保护开始使用 HTTP 响应头:
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
响应头的 Strict-Transport-Security 给浏览器提供了详细的说明。 从现在开始,每个连接到该网站及其子域的下一年(31536000秒)从这个头被接收的时刻起必须是一个 HTTPS 连接。 HTTP 连接是完全不允许的。 如果浏览器接收到使用 HTTP 加载资源的请求,则必须尝试使用 HTTPS 请求替代。 如果 HTTPS 不可用,则必须直接终止连接。
此外,如果证书无效,将阻止你建立连接。 通常来说,如果 HTTPS 证书无效(如:过期、自签名、由未知 CA 签名等),浏览器会显示一个可以规避的警告。 但是,如果站点有 HSTS,浏览器就不会让你绕过警告。 若要访问该站点,必须从浏览器内的 HSTS 列表中删除该站点。
响应头的 Strict-Transport-Security 是针对一个特定的网站发送的,并且覆盖一个特定的域名(domain)。 因此,如果你有 HSTS 的 www.acunetix.com ,它不会覆盖 acunetix. com,而只覆盖 www 子域名。 这就是为什么,为了完全的保护,你的网站应该包含一个对 base domain 的调用(在本例中是 acunetix. com) ,并且接收该域名的 Strict-Transport-Security 头和 includeSubDomains 指令。
Describe alternatives you've considered
for now ,https2https plugin works fine
Affected area
@Becods commented on GitHub (Apr 25, 2022):
首先结论:没有必要
可以手动在frpc端实现
Rewriting the HTTP Host Header
@donargreys commented on GitHub (Apr 28, 2022):
不可行。
理论上,这个是重写request header,而不是response header。
实践上,也在服务器上试过了,不行
p.s. 正常来说,可以在承接frp的后端服务器上完成设置,问题是我用的群晖改起来比较麻烦。
@github-actions[bot] commented on GitHub (May 29, 2022):
Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.