tomcat 支持http2.0嗎?
首先,HTTP2.0協議一級公布,只是推廣和各個中間件軟件的適配需要時間。
stackoverflow里“Tomcat support for HTTP/2.0?”,jetty的源碼碼作者做了如下的總結:
I'm the HTTP/2 implementer in Jetty, and I watch out other projects implementing HTTP/2.Tomcat's Mark Thomas has outlined support for HTTP/2 for Tomcat 9.
Considering that Servlet 4.0 is going to have as a target HTTP/2 support, and that HTTP/2 support requires ALPN support in the JDK (which also I am involved in), and that ALPN support in the JDK is scheduled for JDK 9, it is probably going to be a long time before all that materializes.However, be aware that other Servlet Containers already provide HTTP/2 support.
Jetty 9.3.0 has full, robust, support for HTTP/2, client and server. We have been running HTTP/2 on our own website for many months now, and we consider HTTP/2 support production ready.
Jetty's HTTP/2 Push APIs are being considered for inclusion in Servlet 4.0. HTTP/2 Push is already available to applications deployed to Jetty in a transparent way (via a Servlet Filter).
Undertow also has an implementation for HTTP/2.
Netty also has one, but it's not based on the Servlet APIs.
可以看到,其實很多的中間件廠商都已經准備和JDK(主要是servlet標准)綁定發布了。
開源中國上有一則tomcat9的發布公告:
Apache Tomcat 9.0.0.M1 是 9.0.x 的第一個里程碑版本,提供 9.0.x 的新特性早期預覽,希望能得到用戶的反饋。
值得關注的改進:
- 新增 HTTP/2 支持和 TLS 虛擬主機
- 實現當前 Servlet 4.0 規范草案
- BIO connectors 不再支持 Windows Itanium 和 Comet
comet取消,因為http2.0 加入了 server push的功能。
SPDY vs HTTP2.0
http 2.0 也參考自google的SPDY。雖然SPDY並未成為標准,但是作為一種兼容http協議,並且是高性能和安全的的http訪問方案,也曾在國內的廠商中使用:
作為下一代http協議,HTTPS、SPDY和HTTP/2的性能比較
在SPDY和HTTP/2中都用到的多路復用技術,可以參考這個demo。可以這么考慮,就是http基於文本的傳輸方式太慢,我們希望能夠采用tcp傳輸層中一些經驗,來優化,當然第一步就是把http打包成二進制。
HTTP2.0那些事這篇文章,極為詳細地從SPDY分析到HTTP2.0的誕生。
HTTP vs HTTPS
基於安全的原因,很多公司都把網站換成了https,但是https是需要ca機構簽發證書的,否則像chrome這些瀏覽器會進行安全提示的。
但是網站換成了https之后,會不會影響百度的收錄呢?
參考這篇站點切換https不會對流量產生負面影響。答案是基本不會,如果原來是http,做了映射到 https,狀態碼是 301或302就沒有問題。