Speculation Rules API rollout to free plans

Dear community,

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.

To learn more, please read the documentation: Speculation | Cloudflare Speed docs

We will share (a lot) more on the announcement blog in Birthday week :slight_smile:

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.

Best,
Sam

12 Likes

Hi Sam, thanks for the heads-up!

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)?

3 Likes

Good question! Its via HTTP headers. I forgot to add the docs to my post, so i’m glad you asked :slight_smile:

6 Likes

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.

1 Like

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.

1 Like

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!

How do I turn off Speculation? It seems that I turned it off and it didn’t work. It affects my JS

Speculation is disabled globally at the moment; we will re-enable on Tuesday next week. Therefore it wont be that if anything is affecting your JS.

I recommend starting a new thread with details on your issue.

1 Like