Run phoenix HTTPS behind cloudflare (without key/keyfile)

Hey Guys, I would like to run my site behind cloudflare using their SSL without ssl on my server,
I need to get: https in my Endpoint.url

Currently I’m getting this http

iex(5)> Myapp.AppWeb.Endpoint.url

I tried to config the https config Keyword.put(config, :https, [:inet6, port: "443"])
but I got an error:

    ** (EXIT) shutdown: failed to start child: Phoenix.Endpoint.Handler
        ** (EXIT) an exception was raised:
            ** (ArgumentError) could not start Cowboy adapter, missing option :key/:keyfile

Has anyway to configure https without key/keyfile and get https in my endpoint url?

1 Like

Have you tried setting :scheme to :https or :port to 443 for :url (not :http or :https)?

config :you_app, YourApp.Endpoint,
  url: [scheme: :https, host: "", port: 443], # <-- here
1 Like

I managed to get it work, final config looks like this:

 configs = Keyword.put(config, :http, [:inet6, port: "80"])
 |> Keyword.put(:url, [scheme: "https", host: hostname, port: "443"])