Skip to content

Commit

Permalink
Fiix cors_allow_all for WS
Browse files Browse the repository at this point in the history
  • Loading branch information
Betree committed Nov 23, 2018
1 parent 10fdf5f commit 6a4c222
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rel/runtime_config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,17 @@ config :cf, CF.Mailer,

# ---- [APP CONFIG] :cf_rest_api ----

cors_allow_all? = load_bool.({"cors_allow_all", "false"})
check_origin = if cors_allow_all?, do: false, else: [frontend_url]

config :cf_rest_api, CF.RestApi.Endpoint,
url: [host: load_secret.("host")],
secret_key_base: load_secret.("secret_key_base"),
check_origin: [frontend_url]
check_origin: check_origin

# CORS origins for HTTP endpoint

if load_bool.({"cors_allow_all", "false"}) do
if cors_allow_all? do
config :cf_rest_api, cors_origins: "*"
else
config :cf_rest_api,
Expand Down

0 comments on commit 6a4c222

Please sign in to comment.