XMLHttpRequest cannot load http://localhost:1337/create. Origin null is not allowed by Access-Control-Allow-Origin.
If you get this error, that means that you are not allowed to cross site request, unless the server says you are allowed. Well how do you do this? Simple:
res.header('Access-Control-Allow-Origin', '*');
For production though, depending on how secure you want your web service to be, you might not want to do '*' (allow everything from all domains) but rather restrict it to your own domain.
No comments:
Post a Comment