简体   繁体   中英

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. So between the clients and Cloudflare is http/3 and Cloudflare and VPS is http/1.1 is this correct? 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. (I'm using node so it'll be a switch from http to http2 module)

When your web application / web API is behind Cloudflare, Cloudflare acts as a reverse proxy. This means that there are two "legs" of the connection:

  1. From the end user's client (browser / mobile phone etc...) to Cloudflare
  2. From Cloudflare to your origin server (in your case a 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. This is what you see in the browser when testing, depending on your configuration in the Cloudflare Dashboard.

For leg (2), only HTTP/1.1 is currently supported (as noted also in this Support KB ). You can still optimize the setup of that leg by using features such as Argo Smart Routing or Argo Tunnel ,

Update Jun 2022 : HTTP/2 to the origin server is now supported and can be enabled in the dashboard. See here for more details .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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