39

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

8 Answers 8

72

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

4 Comments

Assuming that curl is installed on that platform. OR, he could call the web server with ANY component that can do HTTP, and retrieve the version number from there.
In case anyone is struggling while running the command above in Git Bash for Windows, the header (see bold part) is printed at the end of this long line (it seems there is a missing newline character there) 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/1.1 302 Found
No, this is wrong. It will only show versions up to the versions that your client (you) are using. For example, depending from where you are initiating the command from, you can get for example HTTP 1.1 or HTTP/2 - so be careful with this option to determine the maximum http version of the version.
I have discovered that if you use HTTPS and add the -v parameter that you get a list of the supported protocols ie.: * ALPN, offering h2 * ALPN, offering http/1.1
18

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

1 Comment

For clearance, what the author means by right click is right-clicking the Name, Status, etc. columns and not the Network Tab
4

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

2 Comments

I don't see the 'view source' option. What am I missing?
Thanks for the question. I tried it on google.com and the button was missing. However, on news.ycombinator.com, the "view source" button was present. If it's missing, it's HTTP/2, reason explained on stackoverflow.com/a/40867107
3

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 

Comments

2

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?

Comments

2

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.

1 Comment

How can one check ALPN? Some openssl s_client command?
1

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:~$ 

Comments

1

$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..

4 Comments

How does this provide any further information than the accepted answer to this question?
just to clarify the syntax to use and get through it quickly.
Essentially, you added only the last line and otherwise more or less copied the other solution without giving proper attribution. You should at least give attribution to Jon!
i had similar req. as i personally executed the above commands for my project.don't comment so blunt.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.