Merge pull request #535 from metamaps/feature/cors
add rack-cors; fix #531
This commit is contained in:
commit
fd9c27c631
3 changed files with 11 additions and 0 deletions
1
Gemfile
1
Gemfile
|
@ -18,6 +18,7 @@ gem 'kaminari' # pagination
|
||||||
gem 'uservoice-ruby'
|
gem 'uservoice-ruby'
|
||||||
gem 'dotenv'
|
gem 'dotenv'
|
||||||
gem 'snorlax'
|
gem 'snorlax'
|
||||||
|
gem 'rack-cors'
|
||||||
gem 'httparty'
|
gem 'httparty'
|
||||||
gem 'active_model_serializers', '~> 0.8.1'
|
gem 'active_model_serializers', '~> 0.8.1'
|
||||||
gem 'delayed_job', '~> 4.0.2'
|
gem 'delayed_job', '~> 4.0.2'
|
||||||
|
|
|
@ -160,6 +160,7 @@ GEM
|
||||||
quiet_assets (1.1.0)
|
quiet_assets (1.1.0)
|
||||||
railties (>= 3.1, < 5.0)
|
railties (>= 3.1, < 5.0)
|
||||||
rack (1.6.4)
|
rack (1.6.4)
|
||||||
|
rack-cors (0.4.0)
|
||||||
rack-test (0.6.3)
|
rack-test (0.6.3)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
rails (4.2.4)
|
rails (4.2.4)
|
||||||
|
@ -286,6 +287,7 @@ DEPENDENCIES
|
||||||
pundit
|
pundit
|
||||||
pundit_extra
|
pundit_extra
|
||||||
quiet_assets
|
quiet_assets
|
||||||
|
rack-cors
|
||||||
rails (= 4.2.4)
|
rails (= 4.2.4)
|
||||||
rails3-jquery-autocomplete
|
rails3-jquery-autocomplete
|
||||||
rails_12factor
|
rails_12factor
|
||||||
|
|
8
config/initializers/cors.rb
Normal file
8
config/initializers/cors.rb
Normal 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
|
Loading…
Reference in a new issue