質問

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