Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does the nginx HTTP/2 module support Server Push?

I'm planning to upgrade my nginx to 1.9.6 which supports HTTP/2.

Have nginx implemented HTTP/2 server push?

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

like image 890
Merik C. Avatar asked Nov 05 '15 05:11

Merik C.


People also ask

How does http2 server push work?

HTTP/2 Server Push allows an HTTP/2-compliant server to send resources to an HTTP/2-compliant client before the client requests them. Server Push is a performance technique aimed at reducing latency by loading resources preemptively, even before the client knows they will be needed.

Does NGINX support http2 by default?

The ngx_http_v2_module module (1.9. 5) provides support for HTTP/2 and supersedes the ngx_http_spdy_module module. This module is not built by default, it should be enabled with the --with-http_v2_module configuration parameter.


2 Answers

Yes, Nginx supports HTTP/2 server push since version 1.13.9, released on February 20, 2018.

The Nginx team pointed out in the original 1.9.5 blog post that it wasn't supported back then.

like image 71
Daniel Stenberg Avatar answered Oct 03 '22 23:10

Daniel Stenberg


Edit:

Nginx supports HTTP/2 server push since v1.13.9, released on February 20, 2018.

Older answer:

Nginx does not support HTTP/2 server push as of March 2017 (v1.11).

Owen Garrett at nginx has summarized the reasons as follows:

  • it is a non-essential and optional part of 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.

  • server push has been available as part of SPDY and was not utilized by many web developers.

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. I also know that some large CDN's like Cloudflare have implemented their own version within nginx to optimize page downloads.

like image 23
Patrick Collins Avatar answered Oct 04 '22 00:10

Patrick Collins