joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[BFCache][Performance] Remove if not limit Cache-Control: no-store usage preventing BFCache on Chrome

Open gilbertococchi opened this issue 8 months ago • 8 comments

Hello everyone, while browsing HTTP Archive public dataset to identify large web performance opportunities I've noticed that the vast majority of Joomla sites seems to be using Cache-Control: no-store (CCNS).

Out of 218K sites using Joomla, 172K have BFCache not available due to "MainResourceHasCacheControlNoStore" BFCache blocking reason (source: HTTP Archive bigquery public data).

Does anybody knows if this high usage of CCNS is expected or could be reconsidered?

If CCNS is not actually necessary, do you have any mechanism to help developers:

  • become aware of this performance opportunity
  • quickly change their caching settings
  • measure the Core Web Vitals benefits/opportunity.

Here there is some useful guidance about the topic: https://web.dev/articles/bfcache?hl=en#minimize-no-store

Chrome has recently released CCNS support upon some conditions but unfortunately this change didn't help Joomla sites CCNS usage: https://developer.chrome.com/docs/web-platform/bfcache-ccns

Happy to discuss if there are folks interested to unlock this great opportunity for Joomla sites.

Hope you appreciate the suggestion. Cheers Gil

gilbertococchi avatar Apr 28 '25 14:04 gilbertococchi

This is similar to https://github.com/joomla/joomla-cms/discussions/43388, not sure @wilsonge if you can share your thoughts on this proposal.

Would it be possible to rethink the no-store usage for non sensitive pages?

Joomla as a CMS seems to heavily overusing CCNS while other CMS don't, this penalize Web Performance of Joomla sites particularly on Back Forward navigations.

gilbertococchi avatar May 07 '25 08:05 gilbertococchi

As far as I understood it happen because by default allowCache is false in AbstractWebApplication https://github.com/joomla-framework/application/blob/3ab2450f712136f1893337a38bb4c4f951cc853b/src/AbstractWebApplication.php#L93 And so the response sent with no-store https://github.com/joomla-framework/application/blob/3ab2450f712136f1893337a38bb4c4f951cc853b/src/AbstractWebApplication.php#L373-L384

I think we can allow cache on CMS level in Web or CMS application. Set $this->allowCache(true). Or I missed anything?

Fedik avatar Nov 10 '25 14:11 Fedik

Hi @Fedik , nice to e-meet you!

Enabling cache would work, but it could also be solved by simply removing no-store in the cachable false condition.

Do you think that there is a strong reason to keep no-store in that condition?

Because by removing no-store only, all sites with those settings would benefit of BFCache while keeping all the no-cache, must-revalidate, post-check=0, pre-check=0 caching settings.

According to public HTTP Archive data there are at least 98K Joomla sites in this situation.

gilbertococchi avatar Nov 10 '25 17:11 gilbertococchi

Do you think that there is a strong reason to keep no-store in that condition?

Yes, for redirects and for administrator area where cache can hurt user experience in some cases. For the site it should be fine to allow cache.

Fedik avatar Nov 10 '25 18:11 Fedik

I mean we definitely should do something. But it's hard with the way cores structured to identify that magic place. You have to have the magic combination of a public menu item, no plugins adding sensitive content and no modules adding sensitive content (and then of course invalidate all of that if a user logs in and that situation changes). Like we definitely could/should do better but I don't know how we can really calculate this situation easily.

wilsonge avatar Nov 10 '25 19:11 wilsonge

Hi George, thanks for chiming in!

I definitively agree with your concerns but from HTTP Archive it looks like approximiately 47% of Joomla origins already enable d Cache removing no-store I guess.

I do wonder if those origins had some issues with sensitive data etc.

I am not sure I can partition the data in HTTP Archive to figure it out if sites on newer version of Joomla are using more or less CCNS.

Keeping CCNS on Admin pages only and if you have a way keep it on Login pages while avoiding it on Homepage, articles etc would be already a great step to improve performance overall.

I suggest a great article from Weston about the topic: https://weston.ruter.net/2025/07/23/instant-back-forward-navigations-in-wordpress/

gilbertococchi avatar Nov 17 '25 11:11 gilbertococchi

I made PR to allow cache for Content views https://github.com/joomla/joomla-cms/pull/46486 When it is okay then we can also enable it for other components.

Do not close this issue for now.

Fedik avatar Nov 23 '25 10:11 Fedik

Thanks for looking at this @Fedik

brianteeman avatar Nov 23 '25 12:11 brianteeman