标签:
7
down vote
accepted
gem install rack-cors
Or in your Gemfile:
gem ‘rack-cors‘, :require => ‘rack/cors‘
修改 config.ru
require ::File.expand_path(‘../config/environment‘, __FILE__)
run Rails.application
require ‘rack/cors‘
use Rack::Cors do
# allow all origins in development
allow do
origins ‘*‘
resource ‘*‘,
:headers => :any,
:methods => [:get, :post, :delete, :put, :options]
end
end
标签:
原文地址:http://www.cnblogs.com/messipapa/p/4813687.html