christianmalek / vuex-rest-api

A utility to simplify the use of REST APIs with Vuex
http://vuex-rest-api.org
MIT License
382 stars 48 forks source link

Not an issue tip for CORS. [Tips] #87

Closed kuwaitbinary closed 6 years ago

kuwaitbinary commented 6 years ago

If you got CORS issues check your NGINX or Apache.

in my case it was Nginx.

`location / {

add_header 'Access-Control-Allow-Origin' '*';

... `

Also do not forgot too allow cross origin in your backend in django it is

ALLOWED_HOSTS = ["bla-bla.com", "localhost", "127.0.0.1"]

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors/CORSMissingAllowOrigin?utm_source=devtools&utm_medium=firefox-cors-errors&utm_campaign=default

christianmalek commented 6 years ago

Thanks for your advice. This is an security mechanism of CORS you'll experience with every server whose domain is different than the client's domain.