Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
allow cross domain
Browse files Browse the repository at this point in the history
  • Loading branch information
wuminzhe committed May 13, 2024
1 parent 1b109b5 commit 7b88957
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,4 @@ gem 'graphiql-rails', group: :development
gem 'graphql'

gem 'kaminari'
gem 'rack-cors'
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -321,6 +323,7 @@ DEPENDENCIES
kaminari
pg (~> 1.1)
puma (>= 5.0)
rack-cors
rails (~> 7.1.2)
redis (>= 4.0.1)
selenium-webdriver
Expand Down
6 changes: 6 additions & 0 deletions config/initializers/cors.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 7b88957

Please sign in to comment.