Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Next.js and React

A React app cannot load an API response: blocked by ORB

Errornet::ERR_BLOCKED_BY_ORB

Short answer

ORB blocks a cross-origin response when the request ran in no-cors mode and the body does not look like something that mode is allowed to load, such as JSON. Remove mode no-cors, let the server send CORS headers, and make sure it returns a Content-Type that matches the body.

  • Applies to Chrome 130+, React 19, Node.js 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Open DevTools, go to Network, click the blocked request and check the Content-Type response header. In the console, log the Response to see if its type is opaque.

    const res = await fetch(url, { mode: "no-cors" });
    console.log(res.type, res.status); // "opaque" 0 means no-cors is in play
  2. 2Match what you see, then jump to its fix

    1. 1res.type is 'opaque', status is 0, body is nullThe request uses mode: 'no-cors' for data you want to readFix
    2. 2The blocked response has content-type application/json or text/html and nosniff in its headersThe server sends X-Content-Type-Options: nosniff with a JSON or HTML type on a no-cors requestFix
    3. 3An image, script or stylesheet is blocked and its content-type is wrong or genericThe Content-Type header does not match the fileFix

What does the error look like?

  • net::ERR_BLOCKED_BY_ORB
  • blocked by orb
  • Response status 0 and an empty body in fetch

Cause 1 of 3

The request uses mode: 'no-cors' for data you want to read

1Check

Search your code for a fetch call or a library option that sets no-cors. That mode makes the request succeed without CORS headers but hides the result from your script.

grep -rn "no-cors" src/

2Fix

Delete the no-cors option so fetch uses the default cors mode, then allow your page's origin on the API server with an Access-Control-Allow-Origin header.

const res = await fetch("https://api.example.com/posts");
const posts = await res.json();

3Verify

The response type is cors and the JSON parses.

console.log(res.type); // "cors"

Confirmed by developer.mozilla.org

Did this fix it?

Cause 2 of 3

The server sends X-Content-Type-Options: nosniff with a JSON or HTML type on a no-cors request

1Check

ORB blocks HTML, JSON and XML responses on no-cors requests when nosniff is set. Look at the response headers of the blocked request.

curl -s -D - -o /dev/null https://api.example.com/posts

2Fix

Do not load a data endpoint through a no-cors path such as an img or script tag or a no-cors fetch. Call it with fetch in cors mode instead.

// not: <script src="https://api.example.com/posts">
const posts = await fetch("https://api.example.com/posts").then(r => r.json());

3Verify

The request now appears in the Network tab as a normal 200 with readable data.

curl -I -H "Origin: https://app.example.com" https://api.example.com/posts

Confirmed by github.com

Did this fix it?

Cause 3 of 3

The Content-Type header does not match the file

1Check

ORB decides from the declared MIME type, then from the first bytes. A response labelled with an audio, image or video type that is not actually that kind, or an error page served with status 404 on an image URL, is blocked.

curl -s -D - -o /dev/null https://cdn.example.com/hero.png

2Fix

Serve each resource with an accurate Content-Type and a 2xx status, and fix the URL if it returns an error page.

# example response headers for a PNG
Content-Type: image/png

3Verify

The headers show the right type and a 200 status.

curl -s -D - -o /dev/null https://cdn.example.com/hero.png

Confirmed by github.com

Did this fix it?

How do I stop it coming back?

  • Treat no-cors as a way to send a request, never as a way to read data.
  • Give every API route a correct Content-Type and set CORS headers for the origins that need them.
  • Check new cross-origin calls in the Network tab before wiring them into components.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.