Skip to content
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

assets are being fetched twice from different hosts #404

Closed
1 of 5 tasks
thescientist13 opened this issue Jul 29, 2020 · 7 comments
Closed
1 of 5 tasks

assets are being fetched twice from different hosts #404

thescientist13 opened this issue Jul 29, 2020 · 7 comments
Assignees
Labels
Guide question Further information is requested v0.9.0 website Tasks related to the projects website / documentation

Comments

@thescientist13
Copy link
Member

Type of Change

  • New Feature Request
  • Documentation / Website
  • Improvement / Suggestion
  • Bug
  • Other (please clarify below)

Summary

Images are being fetched twice, once from assets/* and another call from CloudFront (Netlify).
Screen Shot 2020-07-28 at 8 10 43 PM

Details

Could just be a Netlify setting?
netlify-optimization

But ideally, we would want these images served from a CDN though... wonder if we can get the best of both worlds? 🤔

@thescientist13 thescientist13 added question Further information is requested website Tasks related to the projects website / documentation labels Jul 29, 2020
@thescientist13
Copy link
Member Author

Seems to be happening with fonts too as part of #402, which loads fonts from /assets/
Screen Shot 2020-07-28 at 8 10 56 PM

@thescientist13
Copy link
Member Author

thescientist13 commented Jul 31, 2020

@hutchgrant / @aholtzman
I was just checking in on this, but it looks like it's only happening for me in branch preview environments. If I'm reviewing a PR, I will see the request from both assets/ and CloudFront.

But on production website, the font only loads from CloudFront? Not sure if either of you can confirm.

nm: looks like it is happening now that I am looking. oh well. 🤷‍♂️


On a related note, I wonder if we should benchmark with and without Netlify asset optimization? I wonder if it would be better to make sure Greenwood is doing that all on its own, so it either doens't conflict with what Netlify is trying to do, or unintentionally gets a boost that makes it seem to only work better on Netlify. (e.g. false positive).

Thoughts?

@hutchgrant
Copy link
Member

hutchgrant commented Aug 1, 2020

I'd like to see the difference with and without optimization. Why don't you turn it off and recompile site and test both(I don't have access to greenwood's netlify). I know, testing production is bad. For 5 minutes, it shouldn't be that big a deal.

@thescientist13 thescientist13 self-assigned this Aug 1, 2020
@thescientist13 thescientist13 changed the title images are being fetched twice from different hosts assets are being fetched twice from different hosts Aug 1, 2020
@thescientist13
Copy link
Member Author

thescientist13 commented Aug 2, 2020

OK, disabled this all completely in prod and rebuilt and cleared the site cache via Netlify
Screen Shot 2020-08-02 at 12 15 19 PM

And things are looking much better! Less requests / payload size overall (as expected) with no more CloudFront urls.
Screen Shot 2020-08-02 at 12 01 37 PM
Screen Shot 2020-08-02 at 12 01 46 PM

Found this thread where others reported similar issues but I'm pretty sure Netlify already serves everything off of a CDN anyway so losing the CloudFront specific routes shouldn't be a big deal anyway, and our score definitely didn't get harmed, so I say this is a winner.

I think I'll create a PR to add a netlify.toml for this and other settings, so we can track stuff like this and #331 via code.

@thescientist13
Copy link
Member Author

We should definitely look into font / image preloading though, I think that would be super helpful to have a solution / best practice for.

@hutchgrant
Copy link
Member

can we close this issue then. Loading seems smoother.

@thescientist13
Copy link
Member Author

thescientist13 commented Aug 2, 2020

Shortly, will make some notes in our guides and introduce a netlify.toml first. Doing that now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Guide question Further information is requested v0.9.0 website Tasks related to the projects website / documentation
Projects
None yet
Development

No branches or pull requests

2 participants