Merge pull request #1 from turniere/ticket/TURNIERE-79

Allow access from all origins
This commit is contained in:
Daniel Schädler 2018-11-13 16:14:29 +01:00 committed by GitHub
commit 9c65b98a8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -32,6 +32,8 @@ gem 'bootsnap', '>= 1.1.0', require: false
gem 'devise' gem 'devise'
gem 'devise_token_auth' gem 'devise_token_auth'
gem 'rack-cors'
group :development, :test do group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console # Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw] gem 'byebug', platforms: %i[mri mingw x64_mingw]

View File

@ -98,6 +98,7 @@ GEM
powerpack (0.1.2) powerpack (0.1.2)
puma (3.12.0) puma (3.12.0)
rack (2.0.5) rack (2.0.5)
rack-cors (1.0.2)
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
railroady (1.5.3) railroady (1.5.3)
@ -192,6 +193,7 @@ DEPENDENCIES
devise_token_auth devise_token_auth
listen (>= 3.0.5, < 3.2) listen (>= 3.0.5, < 3.2)
puma (~> 3.11) puma (~> 3.11)
rack-cors
railroady railroady
rails (~> 5.2.1) rails (~> 5.2.1)
rubocop rubocop

View File

@ -33,5 +33,12 @@ module TurniereBackend
# Middleware like session, flash, cookies can be added back manually. # Middleware like session, flash, cookies can be added back manually.
# Skip views, helpers and assets when generating a new resource. # Skip views, helpers and assets when generating a new resource.
config.api_only = true config.api_only = true
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '*', headers: :any, methods: :any
end
end
end end
end end