You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe Fastboot could be serving assets even faster if it were leverage HTTP/2 sever push.
Background
Server push, which is defined in the HTTP/2 specification, allows a server to pre‑emptively push resources to a remote client, anticipating that the client may soon request those resources.
That's perfect for an Ember app because we always have 4 predictable files that need to be loaded:
ember-app.js ember-app.css vendor.js vendor.css
The idea
The idea is to push these 4 files along with the index.html to the client instead of waiting for index.html to land, then fire 4 request, then wait for those requests to land.
Nginx
In Nginx you can specify files to push with http2_push:
Pre-emptively pushing these files increase my project's load times from:
To:
Before:
After:
That's amazing! 🌮
Do give me more! 🙏
Caveat
The Ember files are fingerprinted... Which is great for busting caches when deploying new fixes, but that also breaks having set static http2_push paths.
Bad solution
Stop fingerprinting files in order to leverage static http2_push. 🔥
Is bad because busting caches is arguably more important.
Beter solution
Since NGINX 1.13.9 support was http2_push_preload on; which automatically HTTP/2 server pushes files marked by the Link header.
@janwerkhoven this looks awesome. But this project hasn't had any love in 8 months and I've never gotten a response on any PR in over a year. Maybe fork it?
I believe Fastboot could be serving assets even faster if it were leverage HTTP/2 sever push.
Background
Server push, which is defined in the HTTP/2 specification, allows a server to pre‑emptively push resources to a remote client, anticipating that the client may soon request those resources.
That's perfect for an Ember app because we always have 4 predictable files that need to be loaded:
ember-app.js
ember-app.css
vendor.js
vendor.css
The idea
The idea is to push these 4 files along with the
index.html
to the client instead of waiting forindex.html
to land, then fire 4 request, then wait for those requests to land.Nginx
In Nginx you can specify files to push with
http2_push
:Pre-emptively pushing these files increase my project's load times from:
To:
Before:
After:
That's amazing! 🌮
Do give me more! 🙏
Caveat
The Ember files are fingerprinted... Which is great for busting caches when deploying new fixes, but that also breaks having set static
http2_push
paths.Bad solution
Stop fingerprinting files in order to leverage static
http2_push
. 🔥Is bad because busting caches is arguably more important.
Beter solution
Since NGINX 1.13.9 support was
http2_push_preload on;
which automatically HTTP/2 server pushes files marked by theLink
header.That means in Nginx setting:
And having Fastboot somehow add the following response header when fetching
index.html
:Would preload this JS and CSS file.
Feature request?
Is there a way to add the
Link
header to each Fastboot responses?Does Fastboot have an index of the fingerprinted files we can concatenate into the
Link
header?The text was updated successfully, but these errors were encountered: