By Piotr Sikora

  • javascript

I had a situation last week with requests to server from Vue using Axios where data field has been empty. Server had CORS (Cross-Origin Resource Sharing) enabled.

The most important thing is that it was GET request ran in Chrome. When I ran my url in browser - there was response in JSON format. I've tested this request in Swagger and response was visible. Additionally I've tested it with curl and response was visible as well.

So next idea... lets check it in Firefox. And... it worked well! But what is going on with Chrome?

In console "warning" was visible:

Chrome console warning showing Cross-Origin Read Blocking (CORB) blocked cross-origin response

Cross-Origin Read Blocking (CORB) blocked cross-origin response with MIME type application/json. See https://www.chromestatus.com/feature/5629709824032768 for more details.

So what is CORB?

Cross-Origin Read Blocking (CORB) is an algorithm that can identify and block dubious cross-origin resource loads in web browsers before they reach the web page. CORB reduces the risk of leaking sensitive data by keeping it further from cross-origin web pages. In most browsers, it keeps such data out of untrusted script execution contexts. In browsers with Site Isolation, it can keep such data out of untrusted renderer processes entirely, helping even against side channel attacks like Spectre.

Source: https://chromestatus.com/feature/5629709824032768

And how to solve the issue?

Cross-Origin Read Blocking (CORB) blocked cross-origin response FIX

Make sure these resources are served with a correct "Content-Type" response header from the list below, as well as a "X-Content-Type-Options: nosniff" response header.  These headers ensure Chrome can identify the resources as needing protection, without depending on the contents of the resources.

Source: https://www.chromium.org/Home/chromium-security/corb-for-developers/

So easily said:

  1. Set header to response: X-Content-Type-Options: nosniff

  2. Check that "Content-Type" is correct

Have you had similar issue?

Categories

Recent Posts

About Me

Piotr Sikora - Process Automation | AI | n8n | Python | JavaScript

Piotr Sikora

Process Automation Specialist

I implement automation that saves time and money, streamlines operations, and increases the predictability of results. Specializing in process automation, AI implementation, and workflow optimization using n8n, Python, and JavaScript.

n8n Workflows

n8n workflow automation templates

Explore my workflow templates on n8n. Ready-to-use automations for blog management, data collection, and AI-powered content processing.

3Workflow Templates

• Auto-Categorize Blog Posts with AI

• Collect LinkedIn Profiles

• Export WordPress Posts for SEO

Similar Articles

Discover more related content

Unleash the Power of Autoexecuted Objects in JavaScript

Sometimes you will need to create autoexecuted object (for example in case of load/document ready events)

Pure JavaScript: Private and Public Methods Guide

Have you been creating your own classes in pure JavaScript?

Raspberry Pi node.js and how to start with programming GPIO

Start programming Raspberry Pi GPIO with Node.js. Introduction to the PixPress project on GitHub. Hardware meets JavaScript.