Wyatt Benno
Wyatt Benno

Reputation: 111

SSL for Phoenix working locally but not on production

I have an Phoenix/Elixir App that works fine with https locally, however when I try to change it to use the production certificates the server does not respond and no error messages are shown.

In my dev.exs this was made with the hostname localhost

In prod.exs here are the keys. These were made with my production URL

I have tried to change the localhost to production url on local by adding host into the https portion in the config

https: [port: 443,
      host: "produrl.com"
      keyfile: "priv/keys/domain.key",
      certfile: "priv/keys/domain.crt"],

This throws an error sudo MIX_ENV=prod mix phoenix.server [info] Running LiteChartBe.Endpoint with Cowboy using http://localhost:80 [info] Application lite_chart_be exited: LiteChartBe.start(:normal, []) returned an error: shutdown: failed to start child: LiteChartBe.Endpoint ** (EXIT) shutdown: failed to start child: Phoenix.Endpoint.Server ** (EXIT) shutdown: failed to start child: {:ranch_listener_sup, LiteChartBe.Endpoint.HTTPS} ** (EXIT) shutdown: failed to start child: :ranch_acceptors_sup ** (EXIT) :badarg {"Kernel pid terminated",application_controller,"{application_start_failure,lite_chart_be,{{shutdown,{failed_to_start_child,'Elixir.LiteChartBe.Endpoint',{shutdown,{failed_to_start_child,'Elixir.Phoenix.Endpoint.Server',{shutdown,{failed_to_start_child,{ranch_listener_sup,'Elixir.LiteChartBe.Endpoint.HTTPS'},{shutdown,{failed_to_start_child,ranch_acceptors_sup,badarg}}}}}}}},{'Elixir.LiteChartBe',start,[normal,[]]}}}"} Kernel pid terminated (application_controller) ({application_start_failure,lite_chart_be,{{shutdown,{failed_to_start_child,'Elixir.LiteChartBe.Endpoint',{shutdown,{failed_to_start_child,'Elixir.Phoeni

If I simply forward localhost to produrl in my local hosts file, no errors are thrown and nothing connects to the server using https.

Upvotes: 0

Views: 1187

Answers (1)

SSchneid
SSchneid

Reputation: 90

The error states that you provided a wrong argument for the configuration of your Endpoint (** (EXIT) :badarg). I suppose that is beacause you are missing a comma behind your host url.

This does probably not solve your problem, but that is supposedly the reason for the error message shown after your change.

Upvotes: 1

Related Questions