Skip to content

Commit

Permalink
Merge pull request OperationCode#13 from OperationCode/issue#11
Browse files Browse the repository at this point in the history
Adds CORS. Fixes OperationCode#11
  • Loading branch information
rickr authored Apr 26, 2017
2 parents 10d3f3c + 294623b commit 0a9b24a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
3 changes: 1 addition & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ gem 'operationcode-airtable'
gem 'operationcode-slack'
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.0'
gem 'rack-cors'
gem 'rails', '~> 5.0.2'
gem 'redis', '~> 3.0'
gem 'sidekiq'
Expand All @@ -39,6 +40,4 @@ end
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem 'rack-cors'

2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ GEM
pg (0.20.0)
puma (3.8.2)
rack (2.0.1)
rack-cors (0.4.1)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
Expand Down Expand Up @@ -173,6 +174,7 @@ DEPENDENCIES
operationcode-slack
pg (~> 0.18)
puma (~> 3.0)
rack-cors
rails (~> 5.0.2)
redis (~> 3.0)
sidekiq
Expand Down
18 changes: 9 additions & 9 deletions config/initializers/cors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

# Read more: https://github.com/cyu/rack-cors

# Rails.application.config.middleware.insert_before 0, Rack::Cors do
# allow do
# origins 'example.com'
#
# resource '*',
# headers: :any,
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
# end
# end
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'

resource '*',
headers: :any,
methods: [:get, :post, :put, :patch, :delete, :options, :head]
end
end

0 comments on commit 0a9b24a

Please sign in to comment.