Skip to content
Advertisement

Sending Link Headers for Early Hints in PHP

Cloudflare has introduced Early Hints based on Link Header. I am a little bit confused about how I should send the link header in my PHP script.

As I understand, I should send the Link Header for the links to preconnect

Link: <https://example.com/style.css>; rel="preconnect"

I think we can send HTTP 103 Early Hint via PHP headers

header("Link: <https://example.com/style.css>; rel=preload; as=style", false);

Is it enough?

Advertisement

Answer

No, you actually are required to put nopush at the end, otherwise you’re doing a Push, or set the status code header.

header("Link: <https://example.com/style.css>; rel=preload; as=style; nopush", false);

This would work.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement