Early hints don't work on cloudflare

Testing using the latest CURL. Can see it working on other sites that send 103.

Not seeing 103 on our website.

  1. Early hints enabled in Speed > ## Optimization
  2. HTTP/2 and HTTP/3 enabled
  3. web server (not cached, PHP) sends link header in 200 reply:

link: <https://subdomain.example.com/js/code.js> rel=preload; as=script

Am I understanding correctly that Cloudflare should have created 103 automatically, even if our server is not sending 103, only 200?

May you want to share your command with us? And the domain/URL aswell.

Please have a read here: Support for status code 103 "Early hints" - #12 by LucasCF
Alternatively you can use my tool to test against it: code103.hotmann.de

(maybe soon not available anymore, as I move servers)

curl.exe -X HEAD -I https://simkl.com/
HTTP/2 200
date: Sat, 25 Jun 2022 17:53:13 GMT
content-type: text/html; charset=utf-8
vary: Accept-Encoding
link: <https://us.simkl.in/js/jquery/1.12.0/jquery.min.js> rel=preload; as=script
set-cookie: cc=US; expires=Thu, 22-Dec-2022 17:53:13 GMT; Max-Age=15552000; path=/; domain=.simkl.com; secure; HttpOnly; SameSite=None
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=vWroGdmX6YhsqDvsritcKTyOwlsTN5Qfsg57Xu2CIUbddLbn548D%2FQ58LkMD0C5EOlXLviOjDS464Ho4X2KQhxZByxZ4FuLLPJIgwai0gKl9RQaqLzb3gW67AA%3D%3D"}],"group":"cf-nel","max_age":604800}
nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
set-cookie: __cflb=0H28vsCdsCAvphzb8ThcGi1QVoJaMoqsnDyGC1JYmWd; SameSite=None; Secure; path=/; expires=Sat, 25-Jun-22 18:23:13 GMT; HttpOnly
server: cloudflare
cf-ray: 720f8fb8de46e6dc-EWR
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

Your link header is not set correctly.

please modify it from:
link: <https://eu.simkl.in/js/jquery/1.12.0/jquery.min.js> rel=preload; as=script
to:
link: <https://eu.simkl.in/js/jquery/1.12.0/jquery.min.js>; rel=preload; as=script;
(added semicolons between the attributes)

Set it, like I’ve shown here: Support for status code 103 "Early hints" - #5 by M4rt1n
this is a template for .htaccess (Apache) and nginx.conf (Nginx).

Then it should work.

2 Likes

Nope. Not for me:

$ curl -X HEAD -I https://simkl.com/
HTTP/2 103
link: <https://eu.simkl.in/js/jquery/1.12.0/jquery.min.js>; as=script; rel=preload

HTTP/2 200
date: Sat, 25 Jun 2022 18:00:51 GMT
[...]

Please have a read here: Support for status code 103 "Early hints" - #12 by LucasCF

It describes, why it sometimes does not trigger the 103. I don’t like it and I think it’s not optimal, but thats what we get and it works.

Try it multiple times and you will see the 103.

1 Like

Oh wow, missed ; thank you so much, now seems to be working

You’re welcome!

However, It does reply randomly with 103 and sometimes with 200 only. Hope it’s a temporary edge issue.

For the 3rd time now:

thanks, I am aware of that issue, but these are not cached requests. At least it’s working now.

This does not solely apply to cached ressources, but depends on how quick Cloudflare can retrieve the file.

Here some tests i have made about #103 at Cloudflare, compared to other CDNs which also includes dynamic vs cached content:

These results are a little old and may vary. But dynamic content should always have more hit/ratio than static.

The results are pretty disappointing on Chrome 103
image
saving something like 2ms, it still won’t start downloading the preload file before it gets a reply from Cloudflare edge proxy to the browser. It does start downloading the file first in the queue from 103 while it downloads the full HTML page (blue).

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.