Rails 5 – Trabalhando com CORS

[code type=ruby]
# Gemfile
gem ‘rack-cors’

[code type=ruby]
# config/initializers/cors.rb
Rails.application.config.middleware.insert_before 0, “Rack::Cors” do
allow do
origins ‘localhost:4200’
resource ‘*’,
headers: :any,
methods: %i(get post put patch delete options head)
end
end

Referência

Share and Enjoy !

0Shares
0 0