문제

does anybody know where I can set a header in Sailsjs?

I have to set the Access-Control-Allow-Origin header that I can use my sails instance as API.

Currently I get this error if I try to send a request via $http.get in AngularJs

[Error] XMLHttpRequest cannot load http://acreasyURL.io/signin. Origin http://myhostOnMyMac.io:8000 is not allowed by Access-Control-Allow-Origin.

Any idea?

Cheers!!

도움이 되었습니까?

해결책

Normally, you don't have to set it manually.

Sails has some CORS functionality built in:

https://github.com/balderdashy/sails-docs/blob/bc148104378f1ad590a69220c25f60fe41a59790/config.cors.md

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top