Change CORS for production or dev env
This commit is contained in:
parent
b3cc5a5432
commit
540df78ee9
1 changed files with 8 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue