From ae080314408e0e672fd79a1b087aba265ebc1f14 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 5 Apr 2016 15:54:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E6=94=BE=E8=B7=A8=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 1 + config/application.rb | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/Gemfile b/Gemfile index 9fe511a59..a74d883fa 100644 --- a/Gemfile +++ b/Gemfile @@ -17,6 +17,7 @@ gem 'delayed_job_active_record'#, :group => :production gem 'daemons' gem 'grape', '~> 0.9.0' gem 'grape-entity' +gem 'rack-cors', :require => 'rack/cors' gem 'seems_rateable', '~> 1.0.13' gem 'rails', '~> 3.2' gem "jquery-rails", "~> 2.0.2" diff --git a/config/application.rb b/config/application.rb index 0c55fc75f..a1e14e0d9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -71,6 +71,14 @@ module RedmineApp 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 end