However, as you can see on e.g. https://www.ubuntu.com/cloud, the server-side application has incorrectly generated the links with
http:// rather than
<link rel="canonical" href="http://www.ubuntu.com/cloud">
This means that if Google follows that reference, they will encounter a 301 back to the current page.
While it's obvious that ideally this should be fixed to correctly reference
https://, I feel that this approach of automatically generating self-referential
rel="canonical" links will inevitably be error-prone - e.g., we might generate the links with a trailing slash, but actually on the actual site we have a redirect to remove the slash, etc.
So my question is, does anyone know if there's any SEO cost to pointing
rel="canonical" to a slightly incorrect URL, but where that URL faithfully 301s (or maybe 302s) to the correct URL?