Change CORS for production or dev env

This commit is contained in:
Justin Edmund 2022-12-30 15:55:29 -08:00
parent b3cc5a5432
commit 540df78ee9

View file

@ -7,10 +7,14 @@
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
# origins ENV.fetch("CORS_ORIGIN","").split(",")
origins ["127.0.0.1:1234", "app.granblue.team", "hensei-web-production.up.railway.app"]
if Rails.env.production?
origins %w[app.granblue.team hensei-web-production.up.railway.app]
else
origins %w[127.0.0.1:1234 grid.ngrok.io]
end
resource '*',
headers: :any,
methods: [:get, :post, :put, :patch, :delete, :options, :head]
headers: :any,
methods: %i[get post put patch delete options head]
end
end