Vue-resource: Cross-Origin Request

Created on 16 Jul 2015  路  2Comments  路  Source: pagekit/vue-resource

Hi,

Does anyone knows how to do a http:post via Vue-resource from a different domain?

Thanks in advanced!

Cheers
Ralee

Most helpful comment

  • Backend server should set Access-Control-Allow-Origin to * or [ Frontend server domains whitelist ]
  • Vue.http.options.xhr = { withCredentials: true } is not needed.
  • url must begin with http(s)://. e.g. localhost:8080 would fail.

All 2 comments

You can do it with a normal post $http.post('http://domain.com/'), however the domain must support CORS. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

  • Backend server should set Access-Control-Allow-Origin to * or [ Frontend server domains whitelist ]
  • Vue.http.options.xhr = { withCredentials: true } is not needed.
  • url must begin with http(s)://. e.g. localhost:8080 would fail.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ionutvelicu picture ionutvelicu  路  5Comments

laizhenhai88 picture laizhenhai88  路  4Comments

Jigsaw5279 picture Jigsaw5279  路  5Comments

yozman picture yozman  路  6Comments

Creabine picture Creabine  路  3Comments