-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Link
HTTP headers
#5455
Comments
I think this should happen automatically at the framework level. We're already generating If someone really wants to not prefetch files, they can manipulate the header in |
Perhaps the headers file could be generated / handle this? https://developers.cloudflare.com/pages/platform/headers/ |
Unfortunately Even if it did that would lock it to a single provider: I imagine over the coming years other providers will also do some sort of Early Hint implementations. |
Ah, its in the orange quote at the top: https://developers.cloudflare.com/pages/platform/headers/
I suppose adapters would implement it different ways based on what functionality the platform supports? |
There was an implementation of this in #4785. I think we'd probably have merged it with a bit more work, but the submitter closed the PR. Anyway, there's a lot of valuable discussion there |
Link
HTTP headers
Describe the problem
With Chrome's stable version v103 now integrating RFC 8297 Early Hints, web hosts have started to take note.
Among them is Cloudflare, who supports Automatic Early Hints without making any changes to code (aside from returning a header). It works like this:
SvelteKit relies on lots of small JS files, so allowing these to be returned in the Link header (and benefit from 103 Early Hints on Cloudflare) would likely allow a large speed improvement, especially if the webserver or Worker/Pages Function takes a while to return the response (database lookups etc).
Although relatively new, Early Hints look very promising. Some articles:
Describe the proposed solution
In order for Cloudflare's Automatic Early Hints to work properly, the resources the current page depends on must be returned in a Link header with the regular response.
This is currently impossible with SvelteKit because there is no way to access the manifest. Were there a way to access the manifest (containing which JS files are needed for each route), this could be done inside a hook or similar. E.g:
Alternatives considered
One alternative could be doing this automatically (without user integration). This is actually a good idea except that:
Perhaps a flag in the config might work?
Another alternative would be to make this adapter-specific (i.e. implemented in
adapter-cloudflare
and whenadapter-auto
detects it is running on Cloudflare).Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: