Skip to content

fix: Add CORS for all API requests #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ gem 'turbolinks', '~> 5'
# gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
gem 'redis', '~> 4.0'
# CORS support
gem 'rack-cors'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ GEM
nio4r (~> 2.0)
raabro (1.4.0)
rack (2.2.3)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-protection (2.0.8.1)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.4.4)
Expand Down Expand Up @@ -477,6 +481,7 @@ DEPENDENCIES
omniauth-mlh (~> 0.4.1)
omniauth-rails_csrf_protection
puma (~> 4.3)
rack-cors
rails (~> 5.2.4.4)
rails-controller-testing
rails-settings-cached (~> 0.7.2)
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 '*/events.json', headers: :any, methods: [:get] # Workaround for now
end
end
Binary file added vendor/cache/rack-cors-1.1.1.gem
Binary file not shown.
Binary file removed vendor/cache/tzinfo-1.2.8.gem
Binary file not shown.