Skip to content

Commit dc613d9

Browse files
klaus993JuArce
andauthored
Add SSL termination to the explorer (#1586)
Co-authored-by: Julian Arce <[email protected]>
1 parent 676e6e8 commit dc613d9

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

explorer/config/runtime.exs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,22 @@ if config_env() == :prod do
3535

3636
host = System.get_env("PHX_HOST") || "http://localhost:4000"
3737
port = String.to_integer(System.get_env("PORT") || "4000")
38+
port_ssl = String.to_integer(System.get_env("PORT_SSL") || "443")
3839

3940
config :explorer, :dns_cluster_query, System.get_env("DNS_CLUSTER_QUERY")
4041

4142
config :explorer, ExplorerWeb.Endpoint,
42-
url: [host: host, port: 443, scheme: "https"],
43+
url: [
44+
scheme: "https",
45+
port: port_ssl,
46+
host: host
47+
],
48+
https: [
49+
port: port_ssl,
50+
cipher_suite: :strong,
51+
keyfile: System.get_env("KEYFILE_PATH"),
52+
certfile: System.get_env("CERTFILE_PATH"),
53+
],
4354
http: [
4455
# Enable IPv6 and bind on all interfaces.
4556
# Set it to {0, 0, 0, 0, 0, 0, 0, 1} for local network only access.

explorer/lib/explorer_web/router.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ defmodule ExplorerWeb.Router do
77

88
@content_security_policy (case Mix.env() do
99
:prod ->
10-
"default-src 'self';connect-src wss://#{@host};img-src 'self' blob:;"
10+
"default-src 'self' 'unsafe-inline';connect-src wss://#{@host};img-src https://w3.org http://raw.githubusercontent.com https://*.github.io blob: data:;"
1111

1212
_ ->
1313
"default-src 'self' 'unsafe-eval' 'unsafe-inline';" <>

0 commit comments

Comments
 (0)