How to fix: Canonical URL declared as cleartext HTTP
An HTTPS page declares <link rel="canonical"> pointing at the http:// version of a URL.
Why it matters
Search engines index and link the canonical URL, so results, and every site that copies the canonical from your page, send visitors to the cleartext version. Each of those arrivals is a plaintext first request before any redirect or HSTS policy can act, which is the window an on-path attacker uses to strip TLS.
This survives HTTPS migrations because the canonical URL is usually built from a configured site URL rather than from the current request, so the redirect gets fixed and the configuration does not. The redirect to https does not make it harmless: it fixes the browser's next request, not the link that search results and other sites are handing out.
How to fix it
- 1Change the canonical URL to https, in the site configuration rather than per template.
- 2Check sitemap.xml, og:url, and any RSS or JSON feed for the same stale scheme.
- 3Keep the http to https redirect in place and enable HSTS so an already-published cleartext link costs one plaintext request at most.
Code examples
Canonical over HTTPS
<link rel="canonical" href="https://example.com/articles/tls-migration">
<meta property="og:url" content="https://example.com/articles/tls-migration">Find the remaining cleartext URLs
curl -s https://example.com/sitemap.xml | grep -c 'http://'
curl -s https://example.com/ | grep -i 'rel="canonical"'References
Detected automatically by VulnRadar. The check id is ssl-canonical-link-http, stable across every scan so you can filter or diff on it.
More ssl checks
- HighSecure Cookie Set on HTTP Endpoint
- CriticalSite Served Over Unencrypted HTTP
- InfoExpect-CT Header Not Present
- LowHTTPS Served on Non-Standard Port
- InfoX-HTTP-Method-Override / X-Forwarded-Method Header in Response
- InfoHSTS Present on HTTP Response (SSL-Strip Indicator)
- MediumMixed-Protocol Content (HTTPS Page Loading HTTP Resources)
- LowHSTS declared in a meta tag, where browsers ignore it
Questions
- How severe is Canonical URL declared as cleartext HTTP?
- VulnRadar rates this low severity in the ssl category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id ssl-canonical-link-http, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Canonical URL declared as cleartext HTTP map to?
- It maps to CWE-319. In the OWASP Top 10 it falls under A02:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.