Skip to main content
MediumSSLOWASP A02:2021CWE-319

How to fix: Link header preloads a cleartext subresource

An HTTPS response carries a Link header pointing a subresource relation at an http URL. The relation is one of preload, modulepreload, preconnect, prefetch, dns-prefetch, prerender or stylesheet.

Why it matters

The browser is told to fetch a resource over plain HTTP before the document has even been parsed. For a preloaded script or stylesheet that is active mixed content, so an on-path attacker who substitutes the response gets code execution on the origin. Browsers block active mixed content, which turns this into a hard load failure instead, so the page also breaks.

Header-delivered resource hints are easy to miss in a mixed-content review because nothing in the HTML shows them: they are usually added by a CDN, an edge worker, or a framework's early-hints support. That is also why they tend to hold stale absolute URLs from before the site moved to HTTPS. A protocol-relative or root-relative URL avoids the problem entirely.

How to fix it

  1. 1Change the Link header URLs to https, or to root-relative paths where the resource is same-origin.
  2. 2Check the CDN or edge configuration and any 103 Early Hints response, since those are the usual sources of a header-set hint.
  3. 3Add upgrade-insecure-requests to the CSP so a remaining cleartext hint is upgraded rather than blocked.

Code examples

Same-origin relative preload

text
Link: </assets/app.a91f2c.js>; rel=preload; as=script, </assets/app.a91f2c.css>; rel=preload; as=style

Inspect the header

bash
curl -sI https://example.com/ | grep -i '^link:'

References

Detected automatically by VulnRadar. The check id is ssl-link-header-http-subresource, stable across every scan so you can filter or diff on it.

See every ssl check

Questions

How severe is Link header preloads a cleartext subresource?
VulnRadar rates this medium 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-link-header-http-subresource, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Link header preloads a cleartext subresource 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.

Propose a checkHow a check is built

Scan your own site for link header preloads a cleartext subresource

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

Link header preloads a cleartext subresource fix | VulnRadar