Merge pull request #535 from metamaps/feature/cors

add rack-cors; fix #531
This commit is contained in:
Devin Howard 2016-04-13 10:13:16 +08:00
commit fd9c27c631
3 changed files with 11 additions and 0 deletions

View file

@ -18,6 +18,7 @@ gem 'kaminari' # pagination
gem 'uservoice-ruby'
gem 'dotenv'
gem 'snorlax'
gem 'rack-cors'
gem 'httparty'
gem 'active_model_serializers', '~> 0.8.1'
gem 'delayed_job', '~> 4.0.2'

View file

@ -160,6 +160,7 @@ GEM
quiet_assets (1.1.0)
railties (>= 3.1, < 5.0)
rack (1.6.4)
rack-cors (0.4.0)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.4)
@ -286,6 +287,7 @@ DEPENDENCIES
pundit
pundit_extra
quiet_assets
rack-cors
rails (= 4.2.4)
rails3-jquery-autocomplete
rails_12factor

View file

@ -0,0 +1,8 @@
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/api/*',
headers: :any,
methods: [:get, :post, :put, :delete, :options, :head]
end
end