diff --git a/Gemfile b/Gemfile index 1c06f36..d30786a 100644 --- a/Gemfile +++ b/Gemfile @@ -80,3 +80,4 @@ gem 'graphiql-rails', group: :development gem 'graphql' gem 'kaminari' +gem 'rack-cors' diff --git a/Gemfile.lock b/Gemfile.lock index 0fc78cb..4910889 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -206,6 +206,8 @@ GEM nio4r (~> 2.0) racc (1.7.3) rack (3.0.8) + rack-cors (2.0.2) + rack (>= 2.0.0) rack-session (2.0.0) rack (>= 3.0.0) rack-test (2.1.0) @@ -321,6 +323,7 @@ DEPENDENCIES kaminari pg (~> 1.1) puma (>= 5.0) + rack-cors rails (~> 7.1.2) redis (>= 4.0.1) selenium-webdriver diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb new file mode 100644 index 0000000..6f0174e --- /dev/null +++ b/config/initializers/cors.rb @@ -0,0 +1,6 @@ +Rails.application.config.middleware.insert_before 0, Rack::Cors do + allow do + origins '*' + resource '*', headers: :any, methods: [:get, :post, :patch, :delete, :put, :options] + end +end