Cloudflare changes canonical url

On my homepage “

I get a lighthouse error regarding the canonical url
" Document does not have a valid rel=canonical
Relative URL (//"

I integrate Cloudflare via WP Rocket and the faulty url in the header is triggered by the “Relative Protocol” setting for Cloudflare in WP Rocket.
If I turn it off, it’s ok right away, but as it’s actually rather good for my performance, I would like to find a way to make a page rule exception for that url or something.

Anybody got pointers on that one?

Cloudflare changes canonical url

I am afraid Cloudflare service does not do that.

<link rel="canonical" href="//" />

// double slash usually is written when the schema HTTP or HTTPS is not known, so the browser “decides” with which one to follow or download a resource. Web browsers do not try one protocol and then fall back to the other. The browser will use which ever protocol it is linked to. If that protocol isn’t supported, the user will get an error for that resource.

Double slash // is not the one that I would recommend using.

Finally, the end-user will be directed to either or, depending on which protocol they are currently using.

Furthermore, I see all the links are without schema on your Website, not just the canonical HTML tag.

As far as you are using WordPress, the canonical tag is being generated by some plugin like Yoast SEO.

If there were any changes in URL structure or permalink in the WordPress settings, kindly re-check and re-generate it, or re-save the permalink structure again.

I suggest try using a tool like Yoast SEO Test helper (Yoast Test Helper – WordPress plugin |

Kindly, may I ask have you followed instructions how to propperly setup WP Rocket while using Cloudflare?

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.