Configure CORS headers for submission endpoint

This commit is contained in:
bumi 2020-04-06 00:01:11 +02:00
parent d10ba13735
commit d344256013
3 changed files with 10 additions and 0 deletions

View File

@ -22,6 +22,7 @@ gem 'jbuilder'
gem 'bootsnap', '>= 1.4.2', require: false gem 'bootsnap', '>= 1.4.2', require: false
gem 'google-api-client' gem 'google-api-client'
gem 'rack-cors'
group :development, :test do group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console # Call 'byebug' anywhere in the code to stop execution and get a debugger console

View File

@ -121,6 +121,8 @@ GEM
puma (4.3.3) puma (4.3.3)
nio4r (~> 2.0) nio4r (~> 2.0)
rack (2.2.2) rack (2.2.2)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-proxy (0.6.5) rack-proxy (0.6.5)
rack rack
rack-test (1.1.0) rack-test (1.1.0)
@ -217,6 +219,7 @@ DEPENDENCIES
listen listen
pg pg
puma puma
rack-cors
rails rails
sass-rails sass-rails
spring spring

View File

@ -15,5 +15,11 @@ module Tinyform
# Application configuration can go into files in config/initializers # Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading # -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application. # the framework and any gems in your application.
config.middleware.insert_before 0, Rack::Cors do
allow do
origins '*'
resource '/s/*', headers: :any, methods: [:post, :put, :options]
end
end
end end
end end