简体   繁体   中英

Node.js http2 server with http server for one domain

I want to use http2 protocol in my new project. What I want to achieve is running both http and http2 servers on one domain and one port (if it is possible). Then if comes the client which doesn't understand http2 the communication will stay only in http land. But if new browser comes server would send 101 Switching Protocols and start communicate using http2. Is this possible in node.js? How? Do you need two different ports? Or can both server protocols sit on one port?

  • You can use node-http2 to create an HTTP/2 server with Node.js
  • According to its own github issues , that module is not yet optimized for speed and is not a complete implementation of HTTP/2
  • HTTP/2 servers typically use the same well-known TCP ports (443 & 80) as HTTP/1.1
  • HTTP/2 connections always start as TLS ALPN requests or HTTP/1.1 Upgrade requests
  • The node module implements TLS ALPN, HTTP Upgrade and Plain TCP

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