Skip to content

Commit

Permalink
fix: Disable cors
Browse files Browse the repository at this point in the history
  • Loading branch information
martintomas committed Jan 6, 2025
1 parent f27e41b commit a910816
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ gem "devise"
gem "ransack"
gem "rubyzip"
gem "jwt"
gem "rack-cors"

gem "dotenv-rails"

Expand Down
3 changes: 3 additions & 0 deletions backend/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -504,6 +506,7 @@ DEPENDENCIES
pg (~> 1.4)
pg_search
puma (~> 5.6)
rack-cors
rails (~> 7.0.4)
ransack
redis
Expand Down
9 changes: 9 additions & 0 deletions backend/config/initializers/cors.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a910816

Please sign in to comment.