THE GITHTML FIELD GUIDE

Why report data fails to load across origins

A report that fetches data from another origin may fail because the server does not authorize that browser request through CORS. Inspect the actual error and response headers before changing the document. For a reading-only artifact, embedding an approved static data snapshot often removes the need for cross-origin fetching entirely.

Identify the specific failure

Opening the data URL in a tab does not prove a script may read it from another origin. Navigation and programmatic access are different operations. Authentication, preflight requests, and credentials can further change the result.

Make a narrow correction

Do not treat no-cors mode as a way to read a restricted response; it generally produces an opaque response unavailable to the script. Have the data owner configure authorized access, or render the relevant values into the document before distribution.

  1. Distinguish direct navigation from a script's cross-origin data request.
  2. Inspect preflight and actual responses without copying credentials into the document.
  3. Prefer a dated approved snapshot when the task is reading rather than live interaction.
text
Reading-copy fields: observed values, collection time, scope, known omissions.

Separate response authorization from authentication and parsing

Imagine a report hosted at one origin requesting results.json from another. Opening results.json directly shows readable data, but the report's fetch still fails. Direct navigation proves only that the resource can be opened in that context. It does not establish that the data server authorizes this report origin to read the response programmatically. Inspect the console's precise CORS explanation and the request's Origin context before concluding that the browser has lost network access.

Some requests involve a preflight and others do not. A preflight failure can prevent the intended request from being sent, while a response without the required permission can be received but withheld from the script. Keep those observations separate from a server authentication failure or malformed JSON. A response body containing a login page may cause a parsing error after access succeeds; calling that a CORS problem sends the investigation in the wrong direction. Do not add unrestricted cross-origin permissions without the data owner's review, especially where credentials or private observations are involved.

For a reading-only report, decide which small subset of the data is necessary to support its conclusions. Render that approved subset as a table with its filter, units, and observation time. Include an explicit statement that the values are a snapshot and do not update when the document is opened. This removes the cross-origin dependency without pretending to repair the live application. Check a known row and the total scope against the source, because replacing a failed request with cached or illustrative values would create a visually complete but substantively misleading document.

Verify the repaired artifact

Confirm that the static values state their collection time and scope. Removing a fetch must not imply that old observations are live.

Sources and further reading

AI-assisted writing with source-linked guidance and illustrative examples. Read our editorial approach or report a correction.

All html troubleshooting guides →

Read as MarkdownAll guides

Why report data fails to load across origins · gitHtml