ksuralta
ksuralta

Reputation: 17096

Determine supported HTTP version by the web server

Is there a way to check whether a web server supports HTTP 1.0 or 1.1? If so, how is this done?

Upvotes: 39

Views: 95342

Answers (8)

Grant Wagner
Grant Wagner

Reputation: 25931

This should work on any platform that includes a telnet client:

telnet <host> 80

Then you have to type one of the following blind:

HEAD / HTTP/1.0

or

GET /

and hit enter twice.

The first line returned should output the HTTP version supported:

telnet www.stackoverflow.com 80
HEAD / HTTP/1.0

HTTP/1.1 404 Not Found
Content-Length: 315
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Fri, 31 Jul 2009 15:15:15 GMT
Connection: close

Upvotes: 3

Jonathan Holloway
Jonathan Holloway

Reputation: 63662

You could issue a:

curl --head www.test.com

that will print out the HTTP version in the first line of the output...

e.g.

HTTP/1.1 200 OK
Content-Length: 28925
Content-Type: text/html
Last-Modified: Fri, 26 Jun 2009 16:08:04 GMT
Accept-Ranges: bytes
ETag: "a41944978f6c91:0"
Server: Microsoft-IIS/7.0
X-Powered-By: ASP.NET
Date: Fri, 31 Jul 2009 06:13:25 GMT

Upvotes: 71

Daniel
Daniel

Reputation: 9464

There are two additional methods that can be used to determine the version of HTTP supported by a web server:

Alt-Svc header

Upon a request to the server, the server may return a Alt-Svc header which can specify which versions of HTTP are supported. This information can be used by the browser to determine an upgrade from HTTP/2 to HTTP/3 is possible. For example, when I visit www.google.com, the first request is a HTTP/2 request and contains the following Alt-Svc header:

alt-svc: h3=':443'; ma=2592000,h3-29=':443'; ma=2592000

Here, the h3 means HTTP/3. After this response is received, my browser starts to issue HTTP/3 requests instead of HTTP/2.

enter image description here

ALPN parameter of the SVCB and HTTPS DNS resource records (RR)

Since November 2023 there is a new mechanism for specifying which version of HTTP is supported by a server: the application-level protocol negotiation (ALPN) parameter of the SVCB and HTTPS DNS RR.

Using a tool like dig, you can query this header directly to view it's definition:

dig www.google.com HTTPS

which responds with:

www.google.com.     10061   IN  HTTPS   1 . alpn="h2,h3"

Here you can see the ALPN value is h2 for HTTP/2 and h3 for HTTP/3.

Upvotes: 1

Iman
Iman

Reputation: 18906

In Google Chrome you can see protocol of each requests like this

  1. open developers tools with F12

  2. go to Network Tab

  3. right click any where in column headers (like Name in the picture) and from the context menu select Protocol to be displayed as a new column

  4. then you will see values like h2 (HTTP 2) or http/1.1 entry like the following picture in Protocol column

enter image description here

Upvotes: 15

Ben Butterworth
Ben Butterworth

Reputation: 28482

In Google Chrome and Brave, you can easily use the Developer tools (F12 or Command + Option + I). Open the Network tab, find the request, click the Header tab, scroll down to "Response Headers", and click view source. It should show the HTTP version in the first line.

In the screenshot below, the server is using HTTP/1.1, as you can see: HTTP/1.1 200 OK. If that is missing, it's HTTP/2, since there is no readable source, it's in binary instead.

Network tab screenshot of a Google Chrome browser

Upvotes: 4

nivas
nivas

Reputation: 53

$curl --head https://url:port -k

You get result something like...

HTTP/1.1 200 OK blah....blah. blah...blah..

$ So first line shows version it supports..

Upvotes: 1

user9013730
user9013730

Reputation:

Alternatively, you can also use netcat so that you don't have to type it blindly as in telnet.

user@linux:~$ nc www.stackoverflow.com 80
HEAD / HTTP

HTTP/1.1 400 Bad Request
Connection: close
Content-Length: 0


user@linux:~$

Upvotes: 1

Bhushan Bhangale
Bhushan Bhangale

Reputation: 10987

Read the release notes or the documentation of the webserver to check that. For example Apache Tomcat documentation tells it supports HTTP 1.1

Which webserver are you looking for?

Also are you asking if this can be checked programmatically?

Upvotes: 2

Related Questions