Access to XMLHttpRequest blocked by CORS policy Error

  • 0
  • Pump00:00

enter image description hereI’m developing a web app using codeigniter along with vue.js. I’m also using axios as routing helper. I’ve this JS file in app/src/main.js.


axios.defaults.headers.common['Authorization'] = localStorage.getItem('token');



When I’m passing my header to another vue (say, login) I’m having an error saying:

Access to XMLHttpRequest at 'http://localhost/app/api/login' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field authorization is not allowed by Access-Control-Allow-Headers in preflight response.

Please help me with that.

Default Asked on February 7, 2020 in Programming.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.