Skip to content

Instantly share code, notes, and snippets.

@Arakaki-Yuji
Created December 25, 2014 15:52
Show Gist options
  • Save Arakaki-Yuji/a61f89f671d953915d98 to your computer and use it in GitHub Desktop.
Save Arakaki-Yuji/a61f89f671d953915d98 to your computer and use it in GitHub Desktop.
APIファーストでバックエンドとフロントエンドを別々に開発する時にハマるクロスドメインアクセス ref: http://qiita.com/arakaji/items/f7d32e1c94d67b3e2606
module YourApp
class Application < Rails::Application
# ...
config.middleware.insert_before 0, "Rack::Cors" do
allow do
origins 'your_app_domain'
resource '*', :headers => :any, :methods => [:get, :post, :put, :delete, :options]
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment