Skip to content

Commit cb365c2

Browse files
authored
set secure cookie if BASE_URL scheme is HTTPS (#4623)
1 parent 87dac3b commit cb365c2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

config/runtime.exs

+7-1
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,15 @@ if byte_size(websocket_url) > 0 and
296296
"""
297297
end
298298

299+
secure_cookie_default =
300+
case base_url.scheme do
301+
"http" -> "false"
302+
"https" -> "true"
303+
end
304+
299305
secure_cookie =
300306
config_dir
301-
|> get_var_from_path_or_env("SECURE_COOKIE", if(is_selfhost, do: "false", else: "true"))
307+
|> get_var_from_path_or_env("SECURE_COOKIE", secure_cookie_default)
302308
|> String.to_existing_atom()
303309

304310
license_key = get_var_from_path_or_env(config_dir, "LICENSE_KEY", "")

0 commit comments

Comments
 (0)