1

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?

1 Answer 1

0
  • 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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.