does it make sense to server-push woff2?

David Braun

I'm reading quite a bit about http2's server-push. Also did some experimenting (on a beginner's level)...

Well, my question is: Does it make sense to server-push woff2 web-fonts? (since not every browser uses them), and, is there a method to push the correct font (if not already in the cache)?

Zach points out how important it is to have a fast font-delivery-solution, and CSS-Tricks (Chris Coyer) has a great method to get it done cache-aware...

Thank you! david

Barry Pollard

Well that's an interesting question alright. The answer is: No you should not do this. But the reason is a little different than you might think...

For reasons that are a bit cryptic, fonts are always requested without credentials (basically cookies). For most browsers (Edge being the exception) this means the browser opens another connection for that request and this is important because HTTP/2 Pushes are linked to the connection. So if you push a resource on one connection, and the browser goes to get a resource from another connection it will not use that pushed resource (you do not push directly into the HTTP Cache as you might think).

This, and lots of other HTTP/2 Push trickiness and edge cases were discussed by Jake Archibald in his excellent HTTP/2 push is tougher than I thought article.

But it does beg the question of how you can decide what format to push even if this wasn't an issue, or if you wanted to send different image formats for example (that would be on the same connection). Other than looking at the User-Agent and guessing based off of that, there is now way for you to know what the browser supports.

There is a new HTTP Client Hints header currently being proposed which aims to allow the browser to indicate the device specifics. This currently is more concerned with image size and density, but could in theory also include the file formats that are supported.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Does it make sense to run Kubernetes on a single server?

Does it make sense to have push trigger and nightly build together?

Does it make sense to wrap the SQL Server Serilog sink inside Async?

Does it make sense to deploy TURN and media server in the same network?

Does std::vector.push_back(std::move(foo)) make sense?

Does it make sense to mix regularizers?

Output of program does not make sense

Does pointer to interface make sense?

DACPAC file does not make sense

Validation accuracy does not make sense

inline this function, does make sense?

Does using image sprites make sense in HTTP/2?

Does it make any sense to make struct immutable?

Does it make sense to make this aggregate roots design?

Does it EVER make sense to make an array property?

Does intrusion detection system(IDS) make sense on a firewalled web-server?

Getting Puma Postgres Server to Work in Development to Cooperate with Heroku, or does going back to Sqlite make sense?

Next.js with Custom Express Server gives wrong content type for woff and woff2 files

Does it make sense to make a composite index of 2 columns when one of the columns has a boolean datatype?

Does it make sense to AMP enable a desktop site?

This array reassignment does not make sense to me

React hooks linting : Does it always make sense?

Using ForkJoinPool together with AsyncHttpClient - does it make sense?

Does this generic method signature make sense?

does std::move make sense on a stack variable

Does this method from the JDK make sense to anyone?

Does it make sense to override a method in an interface

Does this make sense to try to save memory?

does serialVersionUID make sense in a java record?