Skip to content

Instantly share code, notes, and snippets.

@sorokadima
Created January 2, 2020 13:08
Show Gist options
  • Save sorokadima/92aae1e9952a2965fb26a90dff1a7752 to your computer and use it in GitHub Desktop.
Save sorokadima/92aae1e9952a2965fb26a90dff1a7752 to your computer and use it in GitHub Desktop.
Rails CORS (Ruby on Rails Cross-Origin Resource Sharing)
module Carservice
class Application < Rails::Application
config.middleware.insert_before 0, "Rack::Cors" do
allow do
origins '*'
resource '*', headers: :any, methods: [:get, :post, :options]
end
end
gem 'rack-cors'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment