Feature: Early hints
Problem Statement
Currently, layout files containing <link>
HTML tags (such as for stylesheets or preload headers) are only processed by the browser after the initial HTML response is received. This delays the loading of important assets. The HTTP 103 Early Hints
status code is supported by most modern web servers (e.g., Caddy, FrankenPHP) and allows the browser to begin loading assets earlier.
Who will benefit?
- Frontend developers concerned with performance.
- End users experiencing faster page loads.
- Projects using Caddy or FrankenPHP for optimized delivery.
Benefits and risks
Benefits:
- Improves perceived and actual page load speed.
- Uses modern HTTP standards (103 Early Hints) for performance optimization.
- Seamless enhancement that does not require changes to frontend code.
- Complements server technologies that already support Early Hints.
Risks:
- Requires web server support for 103 status codes (Caddy, FrankenPHP, etc).
- May introduce complexity in the response pipeline.
- Requires additional parsing and header generation during view rendering.
Proposed solution
Implement functionality in the Hazaar view rendering system to:
- Scan layout templates for
<link>
tags before full rendering. - Generate
Link:
headers for detected tags. - Emit a
103 Early Hints
response containing those headers before the main200 OK
response is sent.
This should be optionally enabled based on server capability and developer configuration.
Examples
Priority/Severity
-
High (This will bring a huge increase in performance/productivity/usability/legislative cover) -
Medium (This will bring a good increase in performance/productivity/usability) -
Low (anything else e.g., trivial, minor improvements)