Hey there fellow devs,
For the love of everything, I can’t seem to get this to work… I have a docker container with a phoenix app running in there. It’s hosted on a subdomain “sub.example.com” and I need to serve it with https.
So I got myself a wildcard SSL certificate, installed it, configured the production file and exposed 80 and 443 ports of the docker container.
Tried it out and port 80 works fine, but 443 is always returning a “ERR_CONNECTION_RESET”. The logs is showing nothing on 443, but 80 works fine.
Been trying for awhile now, and now i need your help. Any idea on whats wrong? Check the code below:
FROM bitwalker/alpine-elixir-phoenix:latest # create app folder RUN mkdir /app WORKDIR /app COPY . . # setting the port and the environment (prod = PRODUCTION!) EXPOSE 80 EXPOSE 443 # install dependencies (production only) RUN mix local.rebar --force RUN mix deps.get --only prod RUN mix compile
config :example, ExampleWeb.Endpoint, http: [port: 80], url: [host: "sub.example.com"], cache_static_manifest: "priv/static/cache_manifest.json", https: [ cipher_suite: :strong, otp_app: :example, port: 443, keyfile: System.get_env("SSL_KEY_PATH"), certfile: System.get_env("SSL_CERT_PATH"), cacertfile: System.get_env("SSL_CHAINED_CERT_PATH") ]
curl https://sub.example.com/ --verbose result:
* Trying 220.127.116.11... * TCP_NODELAY set * Connected to sub.example.com (18.104.22.168) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * successfully set certificate verify locations: * CAfile: /etc/ssl/cert.pem CApath: none * TLSv1.2 (OUT), TLS handshake, Client hello (1): * LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to sub.example.com:443 * Closing connection 0 curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to sub.example.com:443