Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Issue summary: View changes

And apparently Apache's mod_h2 has supported this since November 2016!

See https://mobile.twitter.com/icing/status/872480885068771328 + https://github.com/icing/mod_h2/releases/tag/v1.8.2.

wim leers’s picture

Status: Active » Postponed
Issue tags: +Needs upstream feature, +symfony

The spec was approved a few days ago: https://twitter.com/mnot/status/925135909737054208

https://datatracker.ietf.org/doc/draft-ietf-httpbis-early-hints/

Now we'll still need to wait for Symfony to support this. Using 103 early hint link headers requires support for streamed responses, which Symfony does not support. (This is also why BigPipe in Drupal core had to work around boatloads of Symfony limitations.)

And for now, it doesn't look like that will happen any time soon: https://github.com/symfony/symfony/search?utf8=%E2%9C%93&q=103+early+hin...

wim leers’s picture

>2 years have passed.

Still no support for this in symfony/http-foundation.

matt_paz’s picture

Not sure if this helps, but it looks like at least one part of this was addressed as part of symfony v4.3.5
https://github.com/symfony/symfony/pull/33391

wim leers’s picture

Ohhhhhh!!!!!!!!!! 🤩 Thank you, @matt_paz!

luksak’s picture

Status: Postponed » Active

I guess we could address this since the issues in Symphony have been fixed.

brooke_heaton’s picture

Would love to see this addressed. Thanks!

user654’s picture

.

xamount’s picture

Just an FYI, Cloudflare automatically does this by default. (not sure about other CDNs, but probably..)

See here: https://blog.cloudflare.com/early-hints/. (See section "Now: Turning 200 OK Link: headers into 103 Early Hints")

To summarise: Cloudflare will read your Link headers and push that through early hints via HTTP 103.

wim leers’s picture

Looks like Symfony also gained some support for this since then: https://github.com/search?q=repo%3Asymfony%2Fsymfony+103+early+hint&type...

user654’s picture

.

kentr’s picture

Cloudflare doesn't exactly do this. What it does is send Early Hints for subsequent requests (emphasis mine):

Cloudflare takes these [Link] headers and caches them at our edge, ready to be served as a 103 Early Hints payload.
When subsequent requests come for that asset, we immediately send the browser the cached Early Hints response while proxying the request to the origin server to generate the full response.

So the first response through Cloudflare doesn't have the Early Hints headers (as the first response would if Early Hints were served directly by Drupal). But it's better than what we have now, and the Cloudflare cache can be warmed if needed.

As of April 2023 only FrankenPHP supports early hints headers, according to the Symfony blog.

A comment on that post points out a PR to add Early Hints to standard PHP.

However, PHP should currently be able to add Link headers with preload or preconnect.

They would be there to be picked up by Cloudflare and other proxies, and may add small gains even without Early Hints.

A benefit of specifying preload in the HTTP Header is that the browser doesn't need to parse the document to discover it, which can offer small improvements in some cases.

andypost’s picture

If core will support FrankenPHP there's built-in support for it https://frankenphp.dev/docs/early-hints/

it-cru’s picture

catch’s picture

There's a PHP PR here, although not much recent activity.

https://github.com/php/php-src/pull/7025