简体   繁体   English

nginx HTTP / 2模块是否支持Server Push?

[英]Does the nginx HTTP/2 module support Server Push?

I'm planning to upgrade my nginx to 1.9.6 which supports HTTP/2. 我打算将我的nginx升级到支持HTTP / 2的1.9.6。

Have nginx implemented HTTP/2 server push? 有nginx实现HTTP / 2服务器推送吗?

ref: https://ma.ttias.be/service-side-push-http2-nghttp2/ 参考: https//ma.ttias.be/service-side-push-http2-nghttp2/

Yes, Nginx supports HTTP/2 server push since version 1.13.9 , released on February 20, 2018. 是的,自2018年2月20日发布的1.13.9版以来,Nginx支持HTTP / 2服务器推送。

The Nginx team pointed out in the original 1.9.5 blog post that it wasn't supported back then. Nginx团队在最初的1.9.5博客文章中指出,当时它不受支持。

Edit: 编辑:

Nginx supports HTTP/2 server push since v1.13.9, released on February 20, 2018. 自2018年2月20日发布的v1.13.9起,Nginx支持HTTP / 2服务器推送。

Older answer: 老答案:

Nginx does not support HTTP/2 server push as of March 2017 (v1.11). 截至2017年3月(v1.11),Nginx不支持HTTP / 2服务器推送。

Owen Garrett at nginx has summarized the reasons as follows: nginx的Owen Garrett总结了如下原因:

  • it is a non-essential and optional part of http/2 它是http / 2的非必要和可选部分

  • if the client already has the resource cached, then by pushing it to them you might be unnecessarily wasting bandwidth. 如果客户端已经缓存了资源,那么通过将其推送到它们,您可能会不必要地浪费带宽。

  • server push spec might change in the future. 服务器推送规范可能在未来发生变化。

  • Link headers as hints is useful, but usage has been low from web developers. 链接头作为提示很有用,但Web开发人员的使用率很低。

  • server push has been available as part of SPDY and was not utilized by many web developers. 服务器推送已作为SPDY的一部分提供,并未被许多Web开发人员使用。

Read his original comments here . 在这里阅读他的原始评论。 This table accurately describes the pro's and con's of server hints vs server push. 准确描述了服务器提示与服务器推送的关系和配置。

Personally this disappoints me because I think this would be a valuable feature for web developers willing to invest the time to optimize page speeds. 就个人而言,这令我失望,因为我认为这对于愿意投入时间来优化页面速度的Web开发人员来说是一个很有价值的功能。 I also know that some large CDN's like Cloudflare have implemented their own version within nginx to optimize page downloads. 我也知道像Cloudflare这样的大型CDN已经在nginx中实现了自己的版本来优化页面下载。

Support for http/2 server push has been added to nginx as of Feb 8th, 2018: 自2018年2月8日起,nginx已添加对http / 2服务器推送的支持:

https://hg.nginx.org/nginx/rev/641306096f5b https://hg.nginx.org/nginx/rev/641306096f5b

You need to pay for it with an nginx plus subscription https://www.nginx.com/blog/http2-r7/ . 您需要使用nginx plus订阅https://www.nginx.com/blog/http2-r7/来支付费用。

Apache provides it for free Apache免费提供

https://httpd.apache.org/docs/2.4/mod/mod_http2.html#h2push https://httpd.apache.org/docs/2.4/mod/mod_http2.html#h2push

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM