CORS issue with Vue.js

后端 未结 5 736
鱼传尺愫
鱼传尺愫 2020-12-03 03:37

I\'m using:

  • Vue 2.0.3
  • vue-router 2.0.1
  • vuex 0.8.2
  • vue-resource 0.7.0

And after trying to login to my page when using

5条回答
  •  无人及你
    2020-12-03 04:06

    1) Be sure that server sends Access-Control-Allow-Origin "*" header.

    2) Vue.http.headers.common['Access-Control-Allow-Origin'] = true, Vue.http.headers.common['Access-Control-Allow-Origin'] = '*' and etc. don't needed in the client request.

    3) Vue.http.options.emulateJSON = true should helps if 1 and 2 points already are ok, but vue-resource fails with status 0. Also, try to remove (if they exist) Vue.http.options.credentials = true and Vue.http.options.emulateHTTP = true.

提交回复
热议问题