After a CDN Change, Diagnose Web Fonts Loading From the Wrong URL

Diagnose web fonts loading from the wrong URL after a CDN change. Trace deployed CSS, inspect browser requests, and distinguish missing files from CORS errors.

Published
Reading time
8 min read
After a CDN Change, Diagnose Web Fonts Loading From the Wrong URL
On this page

A CDN or asset-host change can move a stylesheet without moving its font files—or change the stylesheet’s contents so that its font URLs point somewhere unexpected. The result may be a fallback font, a failed request, or a font that returns successfully but cannot be used by the page.

This workflow traces a font from the deployed CSS to the browser request, then separates destination problems from cross-origin and other loading failures.

Key Takeaways

  • Resolve a relative url() in an external stylesheet against the stylesheet’s URL, not the HTML page’s URL.
  • Inspect the CSS delivered to the browser before assuming that the source repository contains the URL being requested.
  • A 404 suggests a missing resource at that destination; a CORS error means the browser could not use a cross-origin response, even if the server returned a successful status.
  • A status check is useful, but it cannot establish that the response is a valid font or that the browser is permitted to use it.
  • Verify the fix in the browser with the affected page, stylesheet, font request, and caches in mind.

Research limitation: MDN’s @font-face documentation and the CDN provider’s documentation were not available for consultation here. The examples below have not been executed. Confirm provider-specific rewriting, caching, and CORS configuration against your CDN’s current documentation.

1. Start with the browser’s font request

Open the affected page in a browser’s developer tools, select the Network panel, and reload. Filter for fonts, then select the affected request. Record:

  • The full request URL, including hostname, path, and query string.
  • The status or browser-reported failure, redirect chain, and final response URL if visible.
  • The request initiator, when available, and any response headers or browser console errors.
  • The page’s origin: scheme, hostname, and port.

If there is no font request, check whether the relevant text actually uses the declared font family and weight. A browser may not request a font until it needs it. A locally installed font, an earlier cached resource, a different stylesheet, or an unsupported source in the src list can also complicate the trace. Browser font-inspection tools can help identify the font actually rendered.

Preserve the first failure for evidence. For a follow-up check, use the browser’s cache-disabling option while developer tools are open, or otherwise test with a clean cache. A service worker or CDN cache can still affect what is delivered, so identify those layers separately.

Advertisement

2. Trace the URL through the deployed CSS

Find the stylesheet that contains the relevant @font-face rule. Open the stylesheet response in developer tools and inspect the delivered CSS, including the applicable src entry. The deployed file may differ from the repository because of a build, asset pipeline, or CDN transformation.

For example, suppose the browser receives this stylesheet at:

https://cdn.example.com/releases/v2/css/site.css

It contains:

@font-face {
  font-family: "Example Sans";
  src: url("../fonts/example-sans.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
}

The relative path resolves to:

https://cdn.example.com/releases/v2/fonts/example-sans.woff2

If the rule instead uses url("/fonts/example-sans.woff2"), the leading slash starts at the stylesheet URL’s origin, producing https://cdn.example.com/fonts/example-sans.woff2. It does not start at the page’s origin merely because the page loaded the stylesheet. For inline CSS, the document’s base URL is relevant instead. For imported stylesheets, trace the URL of the stylesheet containing the rule.

If the stylesheet redirects, inspect its final response URL as well as the original link: the URL used as the stylesheet’s base can differ from the URL initially requested. Also inspect the full src list; a rule can contain multiple candidate URLs or a local() source.

Compare each stage

  1. Source CSS: What URL did the project intend to ship?
  2. Deployed CSS: What URL is actually present in the response? If it differs, investigate the build and any CDN transformations.
  3. Resolved request: Does the browser’s font URL follow from that CSS and stylesheet location?
  4. Destination: Is the font actually deployed at that path on that host?
  5. Response: Does that destination return the expected font, with headers that permit the page to use it?

A CDN may be configured to rewrite asset references, proxy paths, or serve a different cached stylesheet, but the behavior depends on the provider and configuration. Do not assume that moving a CSS file automatically moves or rewrites its fonts. Check the provider’s documentation and the configuration for the affected distribution.

3. Separate a missing file from a cross-origin failure

Use the browser’s Network and Console panels together. Cross-origin means the font destination and the page differ in scheme, hostname, or port.

EvidenceWhat to investigate
404 or 410 for the font requestWrong resolved path, missing deployment, or a CDN route that does not reach the file. Verify the response came from the expected host and path.
403, another error status, or a redirect to a login pageAccess policy, signed URL, origin configuration, or CDN routing. Inspect the response and redirect chain; the status alone may not identify the cause.
CORS error in the console or a browser-reported blocked cross-origin requestInspect the font response’s CORS headers and compare them with the page origin. The server may have returned a successful status that the browser still cannot use.
Successful response but fallback font remainsCheck whether the response is actually a font rather than an HTML error page, whether the browser reports a font decoding error, and whether the family, weight, and style match the text. Also check policies such as Content Security Policy.
No request or an incomplete statusCheck whether the font was selected, whether a policy blocked it, and whether caching, a network failure, or a redirect obscured the result.

For a cross-origin font request, examine Access-Control-Allow-Origin on the relevant response. It must permit the requesting page’s origin under the applicable CORS rules. For a publicly accessible font requested without cross-origin credentials, a server might return Access-Control-Allow-Origin: *; a site using a restricted policy might instead return the specific allowed page origin. If the response varies by request origin, its caching configuration must avoid serving an inappropriate CORS response to another origin.

A CORS error and a missing file can coexist: an error response may also lack the headers needed for the browser to expose it. If browser details are incomplete, inspect the destination separately and compare the result with the browser request. Check redirects and the final response rather than assuming the initial URL tells the whole story.

Advertisement

4. Check the destination independently

Where applicable, enter the font destination in TidyURLs’ HTTP Status Checker to inspect its response status. Compare that status with the browser’s request and redirect chain. Do not submit private, authenticated, or signed URLs to an external checker unless your organization permits it.

A command-line request can provide another view of response headers. Replace the example values with an authorized test URL and the actual page origin:

curl -sS -L --max-time 15 -D - -o /dev/null \
  -H 'Origin: https://www.example.com' \
  'https://cdn.example.com/releases/v2/fonts/example-sans.woff2'

This uses a GET request, follows redirects, and prints response headers. Review the headers for each response and the final status. Do not put credentials or sensitive signed URLs in shared logs or tickets.

Neither this command nor a status checker reproduces all browser behavior. Requests can differ in headers, authentication, cache state, network location, or redirect handling. A 200 also does not prove the body is a valid font, that the correct font variant was returned, or that browser CORS and security policies allow its use. The browser on the affected page remains the final check.

5. Fix the cause and verify the deployment

Choose the fix based on the evidence:

  • Wrong relative path: Update the CSS or build configuration so the resolved path matches the deployed font location. Alternatively, deploy the font at the path the stylesheet references.
  • Wrong host or rewritten path: Correct the asset-host, rewrite, or routing configuration. Inspect the resulting CSS rather than relying only on the configuration change.
  • Correct file, blocked cross-origin response: Configure the font-serving host or CDN to return an appropriate CORS response for the page origin. Verify both successful and relevant error responses, and review caching when headers vary by origin.
  • Correct response, wrong rendering: Check the font file, browser console, @font-face descriptors, and the styles applied to the text.

After deployment, reload the affected page and repeat the trace: inspect the delivered stylesheet, the exact font request, redirects, response headers, console messages, and rendered font. Test the relevant page origins and font variants. If stale content persists, investigate browser, service-worker, and CDN caches according to your deployment procedures.

Common Mistakes

  • Resolving an external stylesheet’s relative font path against the HTML page instead of the stylesheet.
  • Checking only repository CSS while the browser receives a transformed or stale file.
  • Treating a successful status as proof that CORS, font decoding, and rendering all work.
  • Assuming every CORS message means the file exists; an error response can also fail a CORS check.
  • Testing a different URL, origin, or authentication context from the failing browser request.
  • Fixing one font file while overlooking other weights, styles, page origins, or cached responses.

Best Practices

Record the page origin, final stylesheet URL, deployed @font-face rule, font request URL, and browser error in the QA ticket. Keep an inventory of expected font paths and variants for the release, and validate them on a representative page after asset-host changes. Include CDN routing and CORS checks in the deployment review rather than relying on a status-only smoke test.

Conclusion

Start with the CSS the browser actually received, resolve its font URL, and compare that destination with the deployed asset. Then use browser response details to distinguish a path or deployment failure from a cross-origin or rendering problem.

What would your domain sell for?

A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.