This is to inform you of a change we are beginning to roll out today ahead of Cloudflares’ Birthday week; 23/Sept to 27/Sept.
What
We are enabling a new feature called “Speculation Rules API” for all free plan zones. Speculation Rules API is designed to improve the performance of your website or application by targeting future navigation and prefetching relevant assets. Whilst we are beginning with a very conservative implementation, you should still notice some performance improvements.
We will share (a lot) more on the announcement blog in Birthday week
When
Beginning today all free zones are opted-in for Speculation. We will gradually increase the number of Cloudflares’ data centres where traffic has Speculation applied over the coming weeks leading up to 100% of data centers for Birthday week.
This means if we have only one data center enabled today, e.g. LHR, a zone that has Speculation enabled will only have Speculation applied for the traffic going through LHR.
If we see any issues at any time we will revert the rollout and investigate accordingly.
Opt in/out
Free zones can opt-out by navigating to ‘Speed > Optimization > Content Optimization > Speculation’ in your zone.
Non-free zones, such as Pro, Business and Enterprise plan zones, can opt-in by navigating to ‘Speed > Optimization > Content Optimization > Speculation’ in your zone.
Feedback
Hopefully the only impact you see is faster loading times! However If you do experience issues or have any general feedback about Speculation then please either comment on this thread or raise a new post in the community with the tag/word ‘Speculation’. We will be actively monitoring.
Quick question: is this implemented using HTTP headers (similar to how the Early Hints feature works on Cloudflare) or via injecting content into the HTML document (similar to how Rocket Loader works)?
I spent the whole day scratching my head trying to figure out why a sudden warning appeared on my website page, and it turned out that the culprit was the automatically enabled speculative rules. Even after I disabled the features, the CSP is still blocking content. The beta feature is affecting Google’s PageSpeed ratings.
After further testing, I found that the issue was resolved when I removed 'strict-dynamic' from the script-src directive in my CSP rules. This indicates that the error was caused by the speculation script.
I totally understand the frustration! Speculative rules can sometimes cause unexpected issues, especially with CSP (Content Security Policy) settings. After disabling the feature, have you tried adjusting your CSP to allow the specific content that’s being blocked? You might need to update the policy directives to ensure your resources are loaded correctly. Also, clearing the cache or reviewing the headers in your browser’s dev tools could help pinpoint what’s being blocked. If you’re still seeing issues with Google’s PageSpeed, you could try running another audit after adjusting the CSP to see if the rating improves. Hope this helps!
A brief update: We restarted rolling out Speculation on Tuesday (17/September/2024) on a gradual basis.
In the last five minutes (~14:00 UTC, 19/September/2024) all data centers are now applying Speculation API to relevant, applicable traffic for those zones with Speculation enabled. Namely, free plans who have not since opted-out, and zones on non-free plans who have since opted-in.
As always, if you experience any issues as a result please do not hesitate to comment here or start a new thread. The team and I will be monitoring and can advise if your issue is related.
This completely broke my sites.
Ruined my weekend. Wrecked my sales from the past few days. Turn it off! Please do not turn on features by default.
Not Cloudflare’s finest hour.
I hve 3 affected sites. How do I fix this? I never enabled this service. 500+ users have reported that clicking on any internal link results in a 503 error. $10k sales lost in the past week. Please post a fix!
Can you confirm what specifically broke? We’re aware that the use of a 503 to indicate an unsuccessful prefetch can cause some confusion and are looking to change to a different code. Are assets not loading on the page? More info would be very helpful.
" Prefetches that are not successful will respond with a 503 status code. Prefetches that are successful will respond with a 200 status code." Speed Brain | Cloudflare Speed docs
@smarsh Even after enabling and disabling this again on our free plan domain, we’re still seeing requests being made to that. We’re also seeing it on our Pro account, but it was disabled from the start…so maybe something else is going on there. Is there any info I could provide you to help troubleshoot?
@michael.clay apologies, I completely missed this yesterday.
Can you share the names of the sites you’re seeing this on? I appreciate you might not want to share them publicly, however. If so, can you drop me an email with the relevant zone names or URLs and I’ll have the team investigate? smarsh at cloudflare com
Hello Sam, I’m currently experiencing an issue with my https://ospm.app
I’m setting up Content Security Policy.
I have disabled Speed Brain, but I still get attempts from cloudflare to embed the script into my page. It complains that it is enabled in Speculations Rules, but I have no access in dashboard, and I’ve disabled Speed Brain already.
I’ve tried to allow /cdn-cgi/speculation by adding it to script-src or tried to add nonce by replacing it in html, but without a success.
I can’t find the script in html, and can’t allow it, cos I can’t pass the nonce to it, and it causes errors in Sentry.io, which is eating a budget on our errors tracking.
Chrome - if HTML page isn’t already in Cloudflare cache, it throws 503 error until page is refreshed. If throwing 503 error is as per design, this feature shouldn’t be used without a Cache warming solution.