开放跨域

This commit is contained in:
guange 2016-04-05 15:54:30 +08:00
parent 417484f3ad
commit ae08031440
2 changed files with 9 additions and 0 deletions

View File

@ -17,6 +17,7 @@ gem 'delayed_job_active_record'#, :group => :production
gem 'daemons' gem 'daemons'
gem 'grape', '~> 0.9.0' gem 'grape', '~> 0.9.0'
gem 'grape-entity' gem 'grape-entity'
gem 'rack-cors', :require => 'rack/cors'
gem 'seems_rateable', '~> 1.0.13' gem 'seems_rateable', '~> 1.0.13'
gem 'rails', '~> 3.2' gem 'rails', '~> 3.2'
gem "jquery-rails", "~> 2.0.2" gem "jquery-rails", "~> 2.0.2"

View File

@ -71,6 +71,14 @@ module RedmineApp
config.action_view.sanitized_allowed_tags = 'div', 'p', 'span', 'img', 'embed' config.action_view.sanitized_allowed_tags = 'div', 'p', 'span', 'img', 'embed'
config.middleware.use Rack::Cors do
allow do
origins '*'
# location of your API
resource '/api/*', :headers => :any, :methods => [:get, :post, :options, :put]
end
end
config.before_initialize do config.before_initialize do
end end