Get returning null but Wireshark shows different story

Using the above code I see this data in console:

  1. Response {type: ‘opaque’, url: ‘’, redirected: false, status: 0, ok: false, …}

  2. body: (…)

  3. bodyUsed: false

  4. headers: Headers {}

  5. ok: false

  6. redirected: false

  7. status: 0

  8. statusText: “”

  9. type: “opaque”

  10. url: “”

  11. [[Prototype]]: Response

1. arrayBuffer: ƒ arrayBuffer()
2. blob: ƒ blob()
3. body: (...)
4. bodyUsed: (...)
5. clone: ƒ clone()
6. formData: ƒ formData()
7. headers: (...)
8. json: ƒ json()
9. ok: (...)
10. redirected: (...)
11. status: (...)
12. statusText: (...)
13. text: ƒ text()

  1. length: 0
  2. name: "text"
  3. arguments: (...)
  4. caller: (...)
  5. [[Prototype]]: ƒ ()
  6. [[Scopes]]: Scopes[0]

But see this in Wireshark for that fetch request:

GET /cgi-bin/aw_cam?cmd=QIF&res=1 HTTP/1.1

Host: Redacted

Connection: keep-alive

User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Accept: /

Accept-Encoding: gzip, deflate

Accept-Language: en-US,en;q=0.9

HTTP/1.1 200 OK

Connection: close

Content-Type: text/plain

Set-Cookie: Session=0

Accept-Ranges: bytes

Cache-control: no-cache

Content-length: 6

Date: Thu, 08 Feb 2024 09:37:38 GMT


I need to see OIF:4D as a useable response in the return, but Javascript don’t see the data. Any clues as to what I’m doing wrong. Relative newbie here, but I can’t help but think this is a simple problem to fix, I’m just not seeing how.

Please help.

Don’t use no-cors it very likely does not work as you think it does (opaque filtered response.).

You can use a CORS proxy for testing, or better yet create your own backend that sets the header as needed (e.g. in Node using the cors package).

1 Like

Without no-cors I would not get a reply at all.

You can’t use no-cors to bypass CORS blocking. The opaque filtered response you get back can’t be used for much of anything.

The API needs to have the correct headers or you need to add them yourself. There is no other way.

You can create a simple express backend that adds the header and make your client fetch to that backend, that backend will fetch from the actual API.

It is possible to disable CORS in the browser (e.g. settings and extensions) but that isn’t useful to anyone but you and is not the solution. You can use a CORS proxy but again that is only meant for testing and is not a real solution.