How to check if website has http/2 protocol support

拟墨画扇 提交于 2019-12-17 19:16:38

问题


There is a lot of topic about http/2 protocol, but I wonder if there is a working website with this protocol.

i.e.

We can decide to use http:// or https:// but how to write a http/2 request?

I am aware that this protocol depends on server capability, but can not find a way to check if some website e.g. google.com has http2 support enabled.

As I can see in this picture, all modern browsers support this protocol.
I have not seen any link that could look like a new generation protocol.

My question is: Are we using http/2 protocol without knowing or it is just a fairytale?


回答1:


HTTP/2 reuses the http:// and https:// schemes rather than use new ones.

All browsers only support HTTP/2 over https:// and part of the SSL/TLS negotiation is to communicate whether both sides support HTTP/2 and are willing to use it (using an extension to SSL/TLS called ALPN).

The advantage for this is you can just connect to a website and if your browser supports it, it will automatically negotiate HTTP/2, and if not it will automatically fall back to HTTP/1.1.

So to test for HTTP/2 support you can use the browser as Markus's suggests (make sure to add the Protocol column to the Network tab in Chrome for example).

Or you can use an online tester like https://tools.keycdn.com/http2-test

Or you can use a command line tool like openssl (assuming it's been built with ALPN support): openssl s_client -alpn h2 -connect www.example.com:443 -status.

Most of the larger websites (e.g. Twitter, Facebook, Amazon, Stack Overflow) are using HTTP/2 now.




回答2:


You can just check it in: Chrome Dev Tool (F12) > Network > Protocol

It will tell you the protocol used and the domain of each transfer.

Legend

http/1.1 = http 1.1
h2          = http 2.0


Note: If you cannot see the Protocol column just right-click on any header and check the "Protocol" label.




回答3:


Open browser devtools and switch to network tab. There you'll see h2 if http/2 is available.



来源:https://stackoverflow.com/questions/54091567/how-to-check-if-website-has-http-2-protocol-support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!