[Vuejs]-CORS policy in vue.js. Access only in backend?

2👍

✅

Try remove the header const config = {headers: {'Access-Control-Allow-Origin': '*'}}; from the request

The additional header will just confuse the browser

0👍

First way,
Use Cors Plugin in chrome Eg- Moseif CORS or Degrade your chrome version less than 71.

Second way, If you can modify the server-side code (If using express)

Add below codes, You can easily solved this problem.

var cors = require('cors')

var app = express()
app.use(cors())

-3👍

  1. Close the Chrome.
  2. Hold down the Windows Key and Press R on your keyboard. The “RUN” dialog box will open.

  3. Insert the following input field chrome --disable-web-security --user-data-dir and run it

  4. Now run your vue.js app

Hope it helps.

Leave a comment