Last modified: 2012-10-20 09:25:57 UTC
I've tested this in the Wikinews sandbox: https://en.wikinews.org/wiki/Wikinews:Sandbox If I put {{canonicalurl:Main Page}}, the displayed link states "http:// ..." But, the actual provided link is https:// The problem came to light when trying to implement code to conditionally offer a link to the secure version of the site. I note there is bug 38875, asking for {{CANONICALSERVER}}; I'm none-to-fussed how I can test for a page having been loaded over https://, a {{PROTOCOL}} magic word would be nice, but labelling a link as http:// when it is https:// is just plain wrong.
Created attachment 11209 [details] Screenshot showing access via https, with canonicalurl being parsed and displayed as-if an http llink This is likely a bug with far-wider impact than simply the canonicalurl magic word incorrectly being displayed with the wrong protocol. However, the problem I was attempting to solve which highlighted this is obtaining the actual protocol a user is accessing via.
This is by design. canonicalurl returns something canonical, and http:// is configured as the canonical one.
(In reply to comment #2) > This is by design. canonicalurl returns something canonical, and http:// is > configured as the canonical one. Okay, then how does one query which protocol a user is accessing via?
(In reply to comment #3) > (In reply to comment #2) > > This is by design. canonicalurl returns something canonical, and http:// is > > configured as the canonical one. > > Okay, then how does one query which protocol a user is accessing via? There isn't a way to do it in page body AFAIK. Otherwise it splits cache. See bug 31531.