WordPress / performance

Performance plugin from the WordPress Performance Group, which is a collection of standalone performance modules.
https://wordpress.org/plugins/performance-lab/
GNU General Public License v2.0
368 stars 101 forks source link

Disable Speculative Loading by default when the user is logged-in or no-cache headers are sent #1709

Open westonruter opened 2 days ago

westonruter commented 2 days ago

As first mentioned in https://github.com/WordPress/performance/issues/1692#issuecomment-2507032582, Chrome is going to be removing the five-minute rule for <link rel=prefetch>. This means Speculative Loading will no longer work on pages when a user is logged-in since in this case WordPress sends a Cache-Control response header with no-cache, must-revalidate, max-age=0, no-store, private.

Speculative Loading should also be disabled if a page was served with nocache_headers() having been called.

Without these changes, there is a risk that a site may be attempting to prefetch pages only to have them discarded due to the Cache-Control response header. This would needlessly add server load without any user benefit.

A Site Health test for a site unconditionally sending the nocache_headers() would also make sense which is captured in #1692. This is relevant not only for Speculative Loading but also for bfcache.

westonruter commented 2 days ago

cc @felixarntz

westonruter commented 8 hours ago

@tunetheweb has this been on your radar?

tunetheweb commented 8 hours ago

Awaiting 100% confirmation from the Tokyo team but my understanding is this doesn’t affect Speculation Rules.