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.
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 aCache-Control
response header withno-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.