From b6a4d49871bfb1f057c38777afb689a3f61f010a Mon Sep 17 00:00:00 2001 From: Rui Lopes Date: Sat, 18 Nov 2023 18:38:37 +0000 Subject: [PATCH] fix: cors origins regex (#358) --- lib/safira_web/cors.ex | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/safira_web/cors.ex b/lib/safira_web/cors.ex index a3ec363f..da0b1689 100644 --- a/lib/safira_web/cors.ex +++ b/lib/safira_web/cors.ex @@ -1,9 +1,14 @@ defmodule SafiraWeb.CORS do - @moduledoc false + @moduledoc """ + Module responsible for CORS configuration. + Expects CORS_DOMAIN to be set in the environment. + Examples: "localhost:3000", "seium.org" + """ + @domain System.get_env("CORS_DOMAIN") use Corsica.Router, - origins: ~r{^https?::#{@domain}}, + origins: ~r{^https?://#{@domain}}, log: [rejected: :error, invalid: :warn, accepted: :debug], allow_headers: :all, allow_credentials: true,