set access-origin in rails

Author Avatar
Peipei Wong 7月 06, 2018
  • 在其它设备中阅读本文章

记录一下,在rails里面如何设置access-origin….

gem 'rack-cors', :require => 'rack/cors'


config.middleware.insert_before 0, Rack::Cors do
  allow do
    origins '*'
    resource '*', :headers => :any, :methods => [:get, :post, :options]
  end
end