Ember Cli No 'Access-Control-Allow-Origin' header is present on the requested resource?


#1

Hi ,

I am using Ember cli 2.3.0 and Ember data latest version . My Ember client is running http://localhost:4200 .

I want to access server url http://xxx:8777 .

How to Access it ?

My Adapter/application.js :

export default DS.RESTAdapter.extend({ host: “http://xxx:8777”,

pathForType: function(type) {
	return "getuserlist";
}

});


#2

You need to enable CORS by adding a ‘Access-Control-Allow-Origin’ header to the server response. This is a security feature and unless you have access to the remote server this is impossible. If you do have access to the remote server adding the follow header Access-Control-Allow-Origin : * will allow requests from all domains and allow you to develop. You should never use this setting on your production server though as it is insecure. Rather add a whitelist of allowed servers.