rails 项目,支持angular时,做allow - domain - 的设置

访问量: 397

参考: http://stackoverflow.com/questions/29751115/how-to-enable-cors-in-rails-4-app
add to your Gemfile:

gem 'rack-cors'
Add below code to config/application.rb

# Rails 3/4
config.middleware.insert_before 0, "Rack::Cors" do
  allow do
    origins '*'
    resource '*', :headers => :any, :methods => :any
  end
end

订阅/RSS Feed

Subscribe

分类/category