chrisblakley / Nebula

Nebula is a WordPress theme framework that focuses on enhancing development. The core features of Nebula make it a powerful tool for designing, developing, and analyzing WordPress websites consistently, yet its deliberately uncomplicated code syntax also serves as a learning resource for programmers themselves.
https://nebula.gearside.com
GNU General Public License v2.0
139 stars 36 forks source link

HTTP/2 Server Push is being deprecated #2252

Closed chrisblakley closed 11 months ago

chrisblakley commented 12 months ago

Surprised I didn't see this earlier, but HTTP/2 Server Push was removed from Chrome as of version 106.

https://developer.chrome.com/blog/removing-push/

Nebula will need to be updated to remove that functionality and where possible, increase the usage of Early Hints which have been implemented to some extent but could probably be utilized even more.

The same functionality and logic that is used to predict HTTP/2 Server Push could potentially send 103 responses for predicted resources that may be needed– since it also uses response headers.

Screen Shot 2023-07-14 at 11 30 59 AM

chrisblakley commented 11 months ago

Am I oversimplifying this, or is the only difference here that I need to add nopush to the existing headers...?

The Early Hint "Link" header is identical to the http2 server push header except that apparently it just needs nopush added to it:

header('Link: <' . esc_url(str_replace($this->url_components('basedomain'), '', strtok($src, '#'))) . '>; rel=preload; as=' . $filetype . '; nopush' . $crossorigin, false);

https://www.incoherent.ch/2021/10/18/http-link-header-early-hints-and-server-push.html

chrisblakley commented 11 months ago

I have also removed the condition that requires the service worker to be enabled for Early Hints to be sent– they now send on all navigational (non-background) requests.