Skip to content

Commit

Permalink
Fix cors
Browse files Browse the repository at this point in the history
  • Loading branch information
a-wing committed Aug 7, 2018
1 parent 7847d69 commit cf40989
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -21,7 +21,7 @@ gem 'puma', '~> 3.11'
gem 'bootsnap', '>= 1.1.0', require: false

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

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Expand Up @@ -77,6 +77,7 @@ GEM
mini_portile2 (~> 2.3.0)
puma (3.12.0)
rack (2.0.5)
rack-cors (1.0.2)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.0)
Expand Down Expand Up @@ -137,6 +138,7 @@ DEPENDENCIES
byebug
listen (>= 3.0.5, < 3.2)
puma (~> 3.11)
rack-cors
rails (~> 5.2.0)
spring
spring-watcher-listen (~> 2.0.0)
Expand Down
18 changes: 9 additions & 9 deletions config/initializers/cors.rb
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 cf40989

Please sign in to comment.