How to fix "Cross-Origin Read Blocking (CORB) blocked cross-origin response with MIME type application/json." issue?

Thalys Menezes picture Thalys Menezes · Feb 15, 2019 · Viewed 20.5k times · Source

I'm currently developing the frontend (VueJS) for a project and to test my login and register logics I'm using laravel as backend, though we'll be actually working with springboot for backend. I was coding in a desktop and everything was normal. So I just started to work with my laptop. I got the same project, everything is equal. When I use postman to make the requests, it works normally, but when I try to make them with the form from my website, I get that error.

I've looked everywhere but couldn't fix it. Nothing I tryed did work. And It seems that no one else had a similar problem.

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

Answer

Bereket Belete picture Bereket Belete · Oct 9, 2019

Add proxy configuration in vue.config.js file

module.exports = {
  devServer: {
    proxy: 'http://localhost:4000'
  }
}

This will tell the dev server to proxy any unknown requests (requests that did not match a static file) to http://localhost:4000.

here is a link to the doc for more detail