Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know if a request is performed using HTTP 1.x or HTTP2

I want to know if a request between a JavaScript Client and Node.js server is performed using HTTP1.x or HTTP2.

How I know in XMLHttpRequest, Chrome Console and Node.js what type of protocol is used ?

like image 852
Badis Merabet Avatar asked Feb 21 '19 16:02

Badis Merabet


1 Answers

Standard one: performance.timing.nextHopProtocol

Non standard implemetation: window.chrome.loadTimes().connectionInfo

You can check in network tab of dev tools where h2 represents HTTP2,

The Protocol column in the Network panel

When the Protocol column says h2 it means that the resource was sent with HTTP/2. The Protocol column is hidden by default. Right-click the table header and select Protocol to show it. See Show more information for an example.

like image 115
Vikas Yadav Avatar answered Sep 30 '22 07:09

Vikas Yadav