Reputation: 116
Trying to create my first hybrid application using AppGyver's Supersonic. It's angular $http request, work good at ios emulator
$http.get('http://localhost:3000/api/get_data').success (data, status) ->
console.log data
but on android i have problem with CORS, this is error in console i get
XMLHttpRequest cannot load http://localhost:3000/api/get_data. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.
Having server in Rails, here is controller
after_filter :set_access_control_headers
def set_access_control_headers
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Request-Method'] = '*'
end
And headers sets up good, may be i need to change Supersonic configs? Any one using Supersonic?
Upvotes: 0
Views: 635
Reputation: 1119
Have a look at this while facing some error I came across this article. I'm sharing this hoping it will be helpful for others also. http://www.tsheffler.com/blog/?p=428
Also refer this:
Upvotes: 1