Skip to content

Commit

Permalink
Add cors to API
Browse files Browse the repository at this point in the history
  • Loading branch information
johnf committed Oct 17, 2024
1 parent 1b33c24 commit bde658f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ gem 'roo' # Spreadsheet interface
gem 'roo-xls' # Add excel support to roo
gem 'rubyzip' # Zip the large CSV files before emailing
gem 'rufus-scheduler' # Cron
gem 'rack-cors' # API

group :development, :test do
gem 'rails-controller-testing'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,8 @@ GEM
raabro (1.4.0)
racc (1.8.1)
rack (3.1.7)
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 @@ -694,6 +696,7 @@ DEPENDENCIES
opensearch-ruby
paper_trail
puma (>= 5.0)
rack-cors
rails (~> 7.2.0)
rails-controller-testing
rails-reverse-proxy
Expand Down
7 changes: 7 additions & 0 deletions config/initializers/cors.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/oauth/token', headers: :any, methods: [:post]
resource '/api/v1/oni/*', headers: :any, methods: [:get]
end
end

0 comments on commit bde658f

Please sign in to comment.