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.active_record.yaml_column_permitted_classes = [Symbol, BigDecimal]
|
||||||
|
|
||||||
config.autoloader = :zeitwerk
|
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
|
end
|
||||||
|
|
||||||
# Foodsoft version
|
# Foodsoft version
|
||||||
|
|
|
@ -5,12 +5,10 @@
|
||||||
|
|
||||||
# Read more: https://github.com/cyu/rack-cors
|
# Read more: https://github.com/cyu/rack-cors
|
||||||
|
|
||||||
# Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
Rails.application.config.middleware.insert_before 0, Rack::Cors do
|
||||||
# allow do
|
allow do
|
||||||
# origins "example.com"
|
origins '*'
|
||||||
#
|
# this restricts Foodsoft scopes to certain characters - let's discuss it when it becomes an actual problem
|
||||||
# resource "*",
|
resource %r{\A/[-a-zA-Z0-9_]+/api/v1/}, headers: :any, methods: :any
|
||||||
# headers: :any,
|
end
|
||||||
# methods: [:get, :post, :put, :patch, :delete, :options, :head]
|
end
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
Loading…
Reference in a new issue