module YourApp
class Application < Rails::Application
# ...
config.middleware.insert_before 0, "Rack::Cors" do
allow do
origins '*' # or any domain
# origins 'localhost:3000'
resource '*', :headers => :any, :methods => [:get, :post, :options]
# resource '/public/*', :headers => 'x-domain-token', :methods => :get
end
end
end
end