To follow-up from the previous post being about curl, WebSockets and Nginx, now let’s see how to check HTTP versions supported by an endpoint with curl of course.

the command

We gonna test by fetching HEAD requests only (not GET) and that’s being done with passing the --head parameter or -I for the short version of it. This approach should be efficient enough since we only need the response headers to determine the HTTP version.

In my case I’ll use justanotheruptime.com endpoint as an example though.

http/1.1

curl -I https://justanotheruptime.com --http1.1

If HTTP/1.1 is supported, you should see a response starting with:

HTTP/1.1 200

http/2

curl -I https://justanotheruptime.com --http2

Output:

HTTP/2 200

http/3

curl -I https://justanotheruptime.com --http3-only

You’ll most likely get the following error:

curl: option --http3-only: the installed libcurl version doesn't support this
curl: try 'curl --help' or 'curl --manual' for more information

This happens because many curl installations don’t include HTTP/3 support by default… yet. Check HTTP3 (and QUIC) for more info.

As for the workaround, you could use a Docker image that includes HTTP/3 support:

docker run -ti --rm alpine/curl-http3 curl -I https://justanotheruptime.com --http3

Output:

HTTP/3 200

bottom line

And that’s all. Have nothing to add.

Still monitoring your infra manually or with cronjobs? Consider giving justanotheruptime.com a look for a bit automated solution.