Just a note regarding the new Speed Brain setting. It seems it conflicts with prefetch directives in the main body that load dynamic pages, despite the blog saying it “will only work for non-dynamic pages of your website that are cached on our network.”
For example, my forum site has a prefetch statement pointing to the next page in a discussion if the page is LASTPAGE-2 (because the last page might still receive new replies while someone is reading the original page).
In the original configuration (Speed Brain off), the browser loads the prefetch page, and instantly shows it when the visitor clicks NEXT.
With Speed Brain on, it’s not instant anymore. Looking at the DevTools, it seems the page is loaded due to prefetch, but when the NEXT button is clicked/hover, the prefetch cache version is discarded and another request is made, doubling up the requests.
I will post a reply with images to show the behaviour.
Also, I know the blog post says " * Our server parses the request header to identify the prefetch request. If the requested content is present in our cache, we return it; otherwise, we return a 503 HTTP status code and deny the prefetch request. This removes the risk of unsafe side-effects of sending requests to origins or Cloudflare Workers that are unaware of prefetching. Only content present exclusively in the cache is returned."
But it also says "Therefore, Speed Brain will only work for non-dynamic pages of your website that are cached on our network. It has no impact on the loading of dynamic pages.’
Open DevTools, add column “Fulfilled by” and filter by topicid=306138 to see the requests for the page content only.
It will show the page loading and also the next one via prefetch. When clicking NEXT you will see “Fulfilled by (prefetch cache)”. It will load the rendered page really fast.
If you use Speed Brain, you will see the 503, invalidating the prefetch cache. This only happens in this situation, causing the page to be loaded twice (once for prefetch and a second time for navigation).
A phpBB forum tracks read topics in the DB. For viewforum and various searches when unread posts exist in a topic there is a link formatted like this: viewtopic.php?view=unread#unread . The direct link is not used for performance reasons.
The prefetch causes one of two things to happen. If the unread post(s) are on the last page since the request was already made by the pretech they are marked read, there is no post marked unread and unread anchor doesn’t exist because the prefetch effectively marked them read. The other scenario is multiple pages of unread posts in which case they will get bounced to the next page. Certainly content dependent on users actions is not uncommon.
I just spent three days trying to figure out why this was occurring. I don’t use Chrome so it’s still working fine for me in FF, had deployed a major upgade to a site a few days after this was deployed by Cloudflare making me think it’s my issue. I spent hours on a wild goose chase trying to hunt empty href or src tags which is apparently something that can cause Chrome to make double request. I don’t even see anything in Chromes console to indicate this is going on in the background other than it being listed as resource in the network list which is how I finally found the issue. It’s listed but there is no indication of activity apparently because it occurs on the click.
I won’t even go into the issues of skewing stats and other issues like server based software tracking impressions for my direct advertisers. Didn’t think about that did you?
So my question to Cloudflare is why you would think deploying this as on by default was a wise decision?
I posted this on another thread and will repeat it here. Cloudflare has failed big time on Speed Brain and i am very disappointed. Who at Cloudflare thought it would be a good idea to enable this on our domains without notice? I was having an issue of a copy function double firing in an application. After debugging i found all these prefetch requests. Basically each link was getting called twice! That may be ok in some cases but not all and i’m clearly not the only one.