Hello all I was encountering CORS issues with getting my Phoenix API on Fly to accept comms from my NextJS client on Vercel. I finally got it working, but I am not happy about putting this out into production because of that http://localhost:3000
. I would like to provide that as the origin when running in :dev
and then when running in :prod
run the regex origin to match Vercel urls. I am not sure how to go about doing this and also it would need to work on Fly too.
plug(Corsica,
# ...
origins: [~r{vercel-deployment-preview-urls}, "http://localhost:3000"]
)