简体   繁体   English

混淆 http/2,3 和 cloudflare

[英]Confusion http/2,3 and cloudflare

When I start my API server on local it serves http/1.1 but I found that when it's deployed on VPS and set up with Cloudflare, the browser shows the protocol is http/3.当我在本地启动我的 API 服务器时,它提供 http/1.1,但我发现当它部署在 VPS 上并使用 Cloudflare 设置时,浏览器显示协议是 http/3。 So between the clients and Cloudflare is http/3 and Cloudflare and VPS is http/1.1 is this correct?那么客户端和 Cloudflare 之间是 http/3,而 Cloudflare 和 VPS 是 http/1.1,这是正确的吗? That means http/3 is served only by DNS, my server is still plain http/1.1 and I need to migrate it to http/2 to be truly supported http/2.这意味着 http/3 仅由 DNS 提供服务,我的服务器仍然是普通的 http/1.1,我需要将其迁移到 http/2 才能真正支持 http/2。 (I'm using node so it'll be a switch from http to http2 module) (我正在使用节点,所以它将是从httphttp2模块的切换)

When your web application / web API is behind Cloudflare, Cloudflare acts as a reverse proxy.当您的 web 应用程序 / web API 在 Cloudflare 后面时,Cloudflare 充当反向代理。 This means that there are two "legs" of the connection:这意味着连接有两条“腿”:

  1. From the end user's client (browser / mobile phone etc...) to Cloudflare从最终用户的客户端(浏览器/手机等)到 Cloudflare
  2. From Cloudflare to your origin server (in your case a VPS)从 Cloudflare 到您的源服务器(在您的情况下为 VPS)

From a user point of view, they see leg (1) so it is quite easy to enable HTTP/2 or HTTP/3 ( see documentation ) even if your origin server does not support them.从用户的角度来看,他们看到了第 (1) 段,因此即使您的源服务器不支持它们,也很容易启用HTTP/2或 HTTP/3(请参阅文档)。 This is what you see in the browser when testing, depending on your configuration in the Cloudflare Dashboard.这是您在测试时在浏览器中看到的内容,具体取决于您在 Cloudflare 仪表板中的配置。

For leg (2), only HTTP/1.1 is currently supported (as noted also in this Support KB ).对于第 (2) 段,目前仅支持 HTTP/1.1(如本支持 KB 中所述)。 You can still optimize the setup of that leg by using features such as Argo Smart Routing or Argo Tunnel ,您仍然可以使用Argo Smart RoutingArgo Tunnel等功能优化该段的设置,

Update Jun 2022 : HTTP/2 to the origin server is now supported and can be enabled in the dashboard. 2022 年 6 月更新:现在支持到源服务器的 HTTP/2,并且可以在仪表板中启用。 See here for more details . 有关详细信息,请参见此处

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM