8 ms·
Nginx HTTP/2 server push support
- jbergstroem 9y agoI've recently spent more time using H2O over nginx, mainly because of its more complete support of HTTP 2 (push, cache-aware push, ..) but also out of the box support for brotli compression and mruby (think lua landscape for nginx). Even though nginx made it easier to build and ship third party modules separately, I feel like the module community (as well as distro maintainers/packagers) haven't followed suit. There's obviously pre-baked packages like openresty which has lua world, but then there's no brotli.
- youngtaff 9y agoWith you on that one - h2o is a lovely server
- sureaboutthis 9y agoMy web dev company now has a few small clients on h2o for the same reasons. It gives us a chance to try h2o out without any downfall. Still very early but loving it.
- SahAssar 9y agoThe nginx brotli module is very easy to build, I usually build my openresty with brotli and nchan as add in modules and have never encountered any issues.
- vbtechguy 9y agobeen using ngx_brotli with my Centmin Mod Nginx stack for what seems like years now https://community.centminmod.com/threads/how-to-use-brotli-compression-for-centmin-mod-nginx-web-servers.10688/ https://community.centminmod.com/threads/how-to-use-brotli-c... :)
- jbergstroem 9y agoThe upstream repo from google hasn't been updated in over a year; issues are being opened questioning maintainership. It additionally breaks against more recent version combos of nginx/brotli. There's an active fork here (which I also use on my remaining nginx instances) https://github.com/eustas/ngx_brotli https://github.com/eustas/ngx_brotli
- vbtechguy 9y agoyup i am using eustas fork for ngx_brotli works well :)
- x25519 9y agoThey did a static analysis and fixed a null pointer dereference here: https://hg.nginx.org/nginx/rev/8b0553239592 https://hg.nginx.org/nginx/rev/8b0553239592
- jchb 9y agoThey might want to consider using clang nullability annotations (_Nullable etc) when compiling on clang. Can use a macro so it becomes a noop when the compiler does not support it. The static analyser would then get a lot of more information to work with, and it also serves as a kind of documentation.
- alwillis 9y agoGlad push support is finally about to ship.
- seanwilson 9y agoAre there any good general guidelines on when you should use HTTP2 push? Edit: Oops, I missed out "push" at the end.
- ryantownsend 9y agoYou might want to read https://jakearchibald.com/2017/h2-push-tougher-than-i-thought/ https://jakearchibald.com/2017/h2-push-tougher-than-i-though... This is specific to H2 Push
- seanwilson 9y agoYes, I read a few articles like this and it doesn't seem clear when you should use HTTP2 push.
- crishoj 9y agoI would suggest using HTTP/2 whenever possible. Features like connection multiplexing and pipelining alone are huge benefits.
- smartbit 9y agoResearch by Homaan Behesti of Fastly (above at https://news.ycombinator.com/item?id=16365413#16365605 https://news.ycombinator.com/item?id=16365413#16365605) suggest that you test h2 with your site and see how h2 compares to h1.
- eicnix 9y agoAccording to [0] you can gain performance improvements pretty much in every scenario. [0] https://docs.google.com/presentation/d/1r7QXGYOLCh4fcUq0jDdDwKJWNqWK1o4xMtYpKZCJYjM/present?slide=id.p19 https://docs.google.com/presentation/d/1r7QXGYOLCh4fcUq0jDdD...
- niklasrde 9y agoWith some exceptions, we found: https://medium.com/bbc-design-engineering/http-2-is-easy-just-turn-it-on-34baad2d1fb1 https://medium.com/bbc-design-engineering/http-2-is-easy-jus...
- nodesocket 9y agoAwesome. Is this going to make it into stable 1.12.X?
- x25519 9y agoNo, new features don't usually get backported to the stable branch. It will ship with 1.13.9 (mainline) in 6 hours (at the time of writing). For stable branch, you need to wait until the 1.13 milestone is completed, which according to their roadmap (https://trac.nginx.org/nginx/milestone/1.13 https://trac.nginx.org/nginx/milestone/1.13) will be completed in 8 weeks.
- spectrox 9y agoIt should be shipped with 1.13.9 according to the roadmap: https://trac.nginx.org/nginx/roadmap https://trac.nginx.org/nginx/roadmap
- carlosvega 9y agoInteresting video about HTTP 2. https://www.youtube.com/watch?v=0yzJAKknE_k https://www.youtube.com/watch?v=0yzJAKknE_k
- smartbit 9y agoExcellent talk & speaker, slides https://www.slideshare.net/Fastly/http2-what-no-one-is-telling-you https://www.slideshare.net/Fastly/http2-what-no-one-is-telli... Follow up talk Revisiting HTTP/2 given Jan 31, 2018 https://www.youtube.com/watch?v=wR1gF5Lhcq0 https://www.youtube.com/watch?v=wR1gF5Lhcq0 & slides https://www.slideshare.net/Fastly/revisiting-http2-87148462 https://www.slideshare.net/Fastly/revisiting-http2-87148462
- ubercow 9y agoHow are you going to signal nginx what to push? Are you going to be able to push stuff from your application if using Nginx as a proxy? For example, a dynamic view that includes a css file hosted by nginx.
- rictic 9y agoQuoting the OP: > Also, preload links from the Link response headers, as described in https://www.w3.org/TR/preload/#server-push-http-2 https://www.w3.org/TR/preload/#server-push-http-2, can be pushed, if enabled with the "http2_push_preload" directive. So you send down some headers in your response which tells the proxy server resources it should push. Pretty elegant, and fails gracefully. I believe this is the same mechanism as other http2 servers.
- deleted 9y ago[deleted]
- Mojah 9y agoFor those interested, I wrote a lengthy blogpost about HTTP/2 a few years ago, detailing the architectural/infrastructure changes needed to support it for your endusers: https://ma.ttias.be/architecting-websites-http2-era/ https://ma.ttias.be/architecting-websites-http2-era/
- therealmarv 9y agoCan somebody explain in simple words what HTTP/2 push means? Example?
- detaro 9y agoBrowser: "Hey server, send me index.html please" Server: "Sure, here is index.html and you'll need style.css as well, so here is a second stream with that"
- moviuro 9y agoClient: may I get /index.html please? Server: sure, here's index.html, theme.css, and jquery.js. Client: hey wait! I didn't ask for... oh, nvm, good call. Now I can display all this without asking you for anything else. EDIT: See this: https://youtu.be/0yzJAKknE_k?t=30m52s https://youtu.be/0yzJAKknE_k?t=30m52s for more details
- deleted 9y ago[deleted]
- spiderfarmer 9y agoHow is browser support for server push nowadays? Back in March Jake Archibald noticed a lot of oddities in mainly Safari and Edge: https://jakearchibald.com/2017/h2-push-tougher-than-i-thought/ https://jakearchibald.com/2017/h2-push-tougher-than-i-though...
- poyu 9y agoHere's a really nice write up on server push optimization from the Chrome team. Rules of Thumb for HTTP/2 Push https://docs.google.com/document/d/1K0NykTXBbbbTlv60t5MyJvXjqKGsCVNYHyLEXIxYMv0/edit https://docs.google.com/document/d/1K0NykTXBbbbTlv60t5MyJvXj...
- TheAceOfHearts 9y agoPlease correct me if I'm wrong in anything I say here. I haven't had any real-world deployment experiences with HTTP 2.0. Every time I've tried looking into it, I've found it underwhelming. Infrastructure support and tooling is still heavily lacking as far as I can tell. To really take advantage of server push it seems like you'd need to have really good build tools available. Don't you risk sending useless data with server push? How do you handle cached resources? Just because a view depends on some resources, it doesn't mean you always need to send em down to the client. Having server push doesn't always mean you should avoid bundling and minifying resources. Won't a gzipped bundle typically produce a smaller payload? Maybe I'm totally wrong or I've misunderstood something, but the general impression I've gotten is that the benefits of server push are a bit overstated. Does anyone have links to resources which discusses these issues in depth?
- bfred_it 9y agoI think, but could be completely wrong, that browsers can reject a pushed resource at the start. Since the "connection" cost for each resource is minimal, this wouldn't be too much of a problem. Someone confirm or deny this.
- querulous 9y agowith http2 server push the server first sends a frame advertising it's going to push some resource (denoted by it's uri). the client can reject this resource before it's sent. this means the server has to delay sending to give the client the opportunity, however
- SahAssar 9y agoThe server does not delay sending until the advertising frame is acknowledged. So, for a large push the client might cancel the push, but for small pushes the client will already have received the data before the cancel can reach the server. In general, if you are only pushing something that is both small and required that isn't a problem, but when using push for things like MPEG-DASH this becomes a point to think about.
- pgjones 9y agoServer push in Python https://pgjones.gitlab.io/quart/serving_http2.html#server-push-or-push-promises https://pgjones.gitlab.io/quart/serving_http2.html#server-pu... (I am the Quart author, thought this would be interesting and relevant).
- drcongo 9y agoAs someone who loves Flask and finds Django infuriating, I've been keeping an eye on Quart, it looks really interesting.
- mozumder 9y agoThis doesn't seem to have a level of "cache-aware server push" that h2o (awesome http/2 server) has. Is there any info on how Nginx deals with cached server push?
- vbtechguy 9y agobeen testing Nginx 1.13.9 via master branch with my Centmin Mod Nginx stack and HTTP/2 push testing by setting up cache aware HTTP/2 push via conditional preload link resource hints headers which only show up when a cookie is absent https://community.centminmod.com/threads/hurray-http-2-server-push-for-nginx.11910/page-2#post-59423 https://community.centminmod.com/threads/hurray-http-2-serve... works so far but still waiting on bug fix https://trac.nginx.org/nginx/ticket/1478 https://trac.nginx.org/nginx/ticket/1478 as Nginx has pushed back 1.13.9 release until next week https://twitter.com/nginx/status/963442197436678144 https://twitter.com/nginx/status/963442197436678144
- steeve 9y agoStill no HTTP/2 backend support?
- x25519 9y agoNo. Maxim's answer on this issue: https://mailman.nginx.org/pipermail/nginx/2015-December/049445.html https://mailman.nginx.org/pipermail/nginx/2015-December/0494...
- linsomniac 9y agoJust a heads up, we tried to enable H2 with haproxy 1.8.3 last week and had to roll it back because of a Firefox bug. I believe it's this one, which doesn't seem to be getting much attention: https://bugzilla.mozilla.org/show_bug.cgi?id=1427256 https://bugzilla.mozilla.org/show_bug.cgi?id=1427256
- ghusbands 9y agoOn that bug, it looks like the reporter has yet to give an update detailing what the bug actually is (the connection header is a mislead). Their update on Dec 30th says "I'm still working closely together with Willy from Haproxy to determine the actual root cause of http2 failures in Haproxy which only seems to affect Firefox". Without information on the actual fault, it seems like there's little the Firefox developers can do. It could easily be a Haproxy bug.
- kolme 9y agoThat's funny, we couldn't deploy H2 because there were problems with HAProxy/Apache and Safari. And it looks like a very similar issue: http://www.wiktorzychla.com/2017/06/http2-keep-alive-and-safari-browsers.html http://www.wiktorzychla.com/2017/06/http2-keep-alive-and-saf...
- ghusbands 9y agoThat bug is in HAProxy. The RFC clearly states that the presence of the Connection header makes the response malformed. "An endpoint MUST NOT generate an HTTP/2 message containing connection-specific header fields; any message containing connection-specific header fields MUST be treated as malformed (Section 8.1.2.6)." and "Clients MUST NOT accept a malformed response. Note that these requirements are intended to protect against several types of common attacks against HTTP [...]" (though Safari's response of repeatedly retrying as fast as possible is certainly problematic)
- x25519 9y agoThat bug has been fixed in 1.8.3 (https://www.mail-archive.com/haproxy@formilux.org/msg28501.html https://www.mail-archive.com/haproxy@formilux.org/msg28501.h...) Source: https://bugzilla.mozilla.org/show_bug.cgi?id=1427256#c7 https://bugzilla.mozilla.org/show_bug.cgi?id=1427256#c7
- niftich 9y agoAs more software is adding support for HTTP/2 server push, I hope they'll start supporting a higher-level, implementation-agnostic, declarative way of specifying resources to push, which operates at a layer higher than server config directives. Google has a dead-simple JSON format [1] for this from 2015. [1] https://github.com/GoogleChromeLabs/http2-push-manifest https://github.com/GoogleChromeLabs/http2-push-manifest
- SahAssar 9y agoMost servers just read the preload headers from the backend and use that as a push. That won't work with "HTTP 103 Early Hints" (Since it needs to know what to push before the backend responds), but for now a preload header is a good compromise between ease-of-use and good-enough.