Allow access from all origins

This commit is contained in:
Thor77 2018-11-13 16:09:23 +01:00
parent 55df8c92f2
commit b729b37e07
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_token_auth'
gem 'rack-cors'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: %i[mri mingw x64_mingw]

View File

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

View File

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