What if the HTTP / 1.1 client only talks to the HTTP / 2 server and what if the HTTP / 2 client only talks to the HTTP / 1.1 server?

HTTP / 2 is definitely a future trend because it is now an HTTP protocol standard. As we see in Can be used , 70.15% of browsers support HTTP / 2. But HTTP / 2 is so new that there are browsers that only support HTTP / 1.x, and there are many servers that only support HTTP / 1.x. I knew that the client could use the HTTP update mechanism to negotiate the correct protocol to communicate with the server. For example, if the server supports HTTP / 2, their communication protocol will switch to HTTP / 2, otherwise HTTP / 1.x is used. But this only applies to the situation where the browser used by clients supports HTTP / 2 and HTTP / 1.x, right?

But what if a user in a browser that only supports HTTP / 1.x wants to communicate with an HTTP / 2 server? Will the server ignore the request or send an error message back to the user?

But what if a user in a browser that only supports HTTP / 2 wants to communicate with the server only HTTP / 1.1? I think that the process can go as follows: the user sends a connection preface to the server, the server cannot recognize the request, so the user may receive a connection error message. It is right?

Or is there some kind of browser that only supports HTTP / 2?

+8
source share
3 answers

HTTP/1.1, HTTP/2, . , ( , , - - ) .

", HTTP/2", ; HTTP/2, HTTP/1.1. , .

PRI. , , . 400 Bad Request , , .

+5

, HTTP/2 TLS 1.2 ALPN ( ). , TLS. "Client Hello" :

enter image description here

: ", ! , -, - -. " Server Hello":

enter image description here

", ! - -". ", -", -, :

enter image description here

enter image description here

, TLS 1.2, . . , , , .

+15

I tried to visit the http2 server only with curl --http1.1 -i, that's what I got

HTTP/1.0 403 Forbidden
Content-Type: text/plain

Unknown ALPN Protocol, expected 'h2' to be available.
If this is a HTTP request: The server was not configured with the 'allowHTTP1' option or a listener for the 'unknownProtocol' event.
0
source

All Articles