Skip to content

Commit

Permalink
fix: cors origins regex (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
ruilopesm authored Nov 18, 2023
1 parent 772f958 commit b6a4d49
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/safira_web/cors.ex
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit b6a4d49

Please sign in to comment.