Add SSL termination to the explorer #1586
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add SSL termination to the explorer
Description
Manage SSL termination directly from the explorer, to remove the reverse-proxy dependency (caddy)
Changes
explorer/lib/explorer_web/router.ex
: make CSP less strict for the website to be able to:'unsafe-inline'
: execute JS scripts inlineimg-src https://w3.org blob: data:;
: fetch some image/data from w3explorer/config/runtime.exs
: handle SSL certificates from elixir endpointPORT_SSL
env var sets the port for HTTPS endpoint to listen on, not needed as it's defaulted to 443sudo
(not recommended for security reasons)sudo setcap CAP_NET_BIND_SERVICE=+eip /home/app/repos/explorer/aligned_layer/explorer/_build/prod/rel/explorer/erts-14.2.1/bin/beam.smp
KEYFILE_PATH
andCERTFILE_PATH
are the local paths to the SSL private key and the certificate, if not set, HTTP endpoint will be brought up, but not HTTPS oneif config_env() == :prod
, local development setup changes are not needed