Closed axelson closed 3 years ago
So this probably isn't the best by itself because I later realized that Let's Encrypt's HTTP-01 challenge type (the type used by site_encrypt I think) requires port 80 to be open: https://letsencrypt.org/docs/allow-port-80/
But it would be nice to give a better error in the case of http: false
So this probably isn't the best by itself because I later realized that Let's Encrypt's HTTP-01 challenge type (the type used by site_encrypt I think) requires port 80 to be open
Precisely.
But it would be nice to give a better error in the case of
http: false
I agree. I think that raising an error in this case should be the way to go.
Okay, I've changed the code to raise an error instead. This is what it looks like when ran:
[error] GenServer GenTrackerWeb.Endpoint terminating
** (RuntimeError) Unable to retrieve HTTP port from the HTTP configuration. SiteEncrypt relies on the Lets Encrypt HTTP-01 challenge type which requires an HTTP version of the endpoint to be running and the configuration received did not include an http port.
Received: false
(site_encrypt 0.4.2) lib/site_encrypt/phoenix.ex:132: SiteEncrypt.Phoenix.raise_http_required/1
(site_encrypt 0.4.2) lib/site_encrypt/phoenix.ex:106: SiteEncrypt.Phoenix.start_acme_server/1
(parent 0.12.0) lib/parent.ex:646: Parent.start_validated_child/2
(parent 0.12.0) lib/parent.ex:375: Parent.start_child/2
(parent 0.12.0) lib/parent.ex:396: anonymous fn/1 in Parent.start_all_children!/1
(elixir 1.12.0-rc.0) lib/enum.ex:1553: Enum."-map/2-lists^map/1-0-"/2
(elixir 1.12.0-rc.0) lib/enum.ex:1553: Enum."-map/2-lists^map/1-0-"/2
(parent 0.12.0) lib/parent/supervisor.ex:51: Parent.Supervisor.init/1
Thank you!
An endpoint that is only https will likely have
false
as the:http
configuration, which is the default: https://hexdocs.pm/phoenix/1.5.8/Phoenix.Endpoint.html?#module-adapter-configurationWithout this you get an error like: