move CORS setup to initializer
This commit is contained in:
parent
20a67becf5
commit
4bfa87d258
2 changed files with 7 additions and 20 deletions
|
@ -68,17 +68,6 @@ module Foodsoft
|
|||
config.active_record.yaml_column_permitted_classes = [Symbol, BigDecimal]
|
||||
|
||||
config.autoloader = :zeitwerk
|
||||
|
||||
# Ex:- :default =>''
|
||||
|
||||
# CORS for API
|
||||
config.middleware.insert_before 0, Rack::Cors do
|
||||
allow do
|
||||
origins '*'
|
||||
# this restricts Foodsoft scopes to certain characters - let's discuss it when it becomes an actual problem
|
||||
resource %r{\A/[-a-zA-Z0-9_]+/api/v1/}, headers: :any, methods: :any
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Foodsoft version
|
||||
|
|
|
@ -5,12 +5,10 @@
|
|||
|
||||
# Read more: https://github.com/cyu/rack-cors
|
||||
|
||||
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
||||
# allow do
|
||||
# origins "example.com"
|
||||
#
|
||||
# resource "*",
|
||||
# headers: :any,
|
||||
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
||||
# end
|
||||
# end
|
||||
Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
||||
allow do
|
||||
origins '*'
|
||||
# this restricts Foodsoft scopes to certain characters - let's discuss it when it becomes an actual problem
|
||||
resource %r{\A/[-a-zA-Z0-9_]+/api/v1/}, headers: :any, methods: :any
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue