diff --git a/backend/Gemfile b/backend/Gemfile index 98db484..6fa35ea 100644 --- a/backend/Gemfile +++ b/backend/Gemfile @@ -17,6 +17,7 @@ gem "devise" gem "ransack" gem "rubyzip" gem "jwt" +gem "rack-cors" gem "dotenv-rails" diff --git a/backend/Gemfile.lock b/backend/Gemfile.lock index 448cc28..e298419 100644 --- a/backend/Gemfile.lock +++ b/backend/Gemfile.lock @@ -277,6 +277,8 @@ GEM nio4r (~> 2.0) racc (1.8.1) rack (2.2.10) + rack-cors (2.0.2) + rack (>= 2.0.0) rack-test (2.2.0) rack (>= 1.3) rails (7.0.8.7) @@ -504,6 +506,7 @@ DEPENDENCIES pg (~> 1.4) pg_search puma (~> 5.6) + rack-cors rails (~> 7.0.4) ransack redis diff --git a/backend/config/initializers/cors.rb b/backend/config/initializers/cors.rb new file mode 100644 index 0000000..d5b1df5 --- /dev/null +++ b/backend/config/initializers/cors.rb @@ -0,0 +1,9 @@ +Rails.application.config.middleware.insert_before 0, Rack::Cors do + allow do + origins "*" + resource "*", + headers: :any, + methods: [:get, :post, :put, :patch, :delete, :options, :head], + credentials: false + end +end