-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
feat(templates): add Link header for Early Hints, HTTP2 Server Push etc. #3200
Conversation
Hi @Plopix, Welcome, and thank you for contributing to Remix! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected]. Thanks! - The Remix team |
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
Hi @Plopix and thank you for opening this PR! |
Hello @machour, it's done! |
I like this idea, but I have a question, in daffy.org we import multiple copies of the same image in different sizes to support different pixel densities and for desktop and mobile, I then preload them using a link tag which supports imagesrcset and media for media queries. Will this change send Link header to preload all of my images? Even the ones I don’t really need? Because right now an iPhone user for example only loader one of those images (mobile an 3x size) and not the rest, but Link header doesn’t support srcSet and media queries to conditionally load images. |
thanks @MichaelDeBoey much cleaner ;-) changed and pushed! @sergiodxa the first piece of code will add the list of modules and imports (basically just the chunks).
The second line answers "a bit more" your question:
If a
So to really answer your question the
Here we the Conclusion: it should not impact you ;-) |
I think we should remove the Checking the header maybe, but there is something. |
btw @mjackson or @ryanflorence do you want to talk about that PR (like 10-15min) after the conf or tomorrow morning? |
I think keeping them should not affect, right? The browser will already have the cached file so it will not request it again, and if for some reason the browser didn't downloaded the files from the header it has another opportunity to do it before actually needing the file. |
I initially thought Remix could do this OOTB but now I think this should come in the template or be a function (I’m planning to add it to Remix Utils), the reason is because if the developer decides to remove the Scripts component this will push the JS files but nothing will use them. Another thing is that this same technique can be used to know the linked assets and push them automatically, I was able to do it in my personal site to preload CSS and other assets https://github.com/sergiodxa/sergiodxa.com/blob/bf3ecf401b7e1406044d9480129cb5dd3063d0c0/app/entry.server.tsx#L53 |
v1.14.0 removed the need to have entry files & we removed them from our templates as well. @Plopix Could you rebase your PR onto latest |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Plopix You should update the files in remix-dev/config/defaults
instead
ok will do ! |
I wonder if |
Hmm... my understanding is that HTTP2 Server Push is being deprecated. Chrome is removing support for it in an upcoming release. Apparently, there are not enough implementations on the server side to make it worthwhile to maintain support. So not sure this is worth adding to the default templates. |
yes that's true, the new stuff to look for is probably: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/103 |
Hi @Plopix! Are you still interested in getting this one merged? If so, please rebase onto latest |
Hi everyone! Depending on @Plopix availability for this, I'm volunteering to help getting it merged if needed. Please let me know if help is needed here. |
I am a bit confused actually here. Where should I do changes finally? At some point in this PR I have been told to do not change anything in |
THIS IS AMAZING! |
I'm going to close this out due to #3200 (comment) and because we have an open proposal that will go through our Open Develoment Process in #5378. Also because this can be done today in userland in your |
Hello,
Context
When using HTTP/2 we can optimize the first loading with HTTP/2 Server Push
Link
header.I had to implement it for a project and I wonder if it might cool to have it in Remix directly.
Probably not be the best place to put this code but at least this PR open the topic, and make it simple to test ;)
Should we have that in Remix by default? or with a configuration?
What do you think?
Testing with HTTPS and HTTP2 locally
Then here a simple Caddyfile
Results