Choosing a proper local address for caddy running inside a container to obtain a proper SSL certificate

47 Views Asked by At

My caddy docker container name is caddy-1 with IP 172.0.0.10, and my docker host IP is 192.168.1.10.

Which of below Caddyfile block should I use to autogenerate a useful SSL certificate?

A configuration resembling docker host address and port:

192.168.1.10:8080 {
    tls internal # for generating locally-trusted certificates
}

or a configuration resembling container address in port:

172.0.0.10:80 {
    tls internal
}

or a configuration resembling container name:

caddy-1 {
   tls internal
}

?

Potential problems might be:

  • Using 172.0.0.10 in my Caddyfile while accessing the server from 192.168.1.10 could lead to a mismatch between the address and SSL certificate.
  • Using 192.168.1.10 in my Caddyfile could mean manually moving certificates from inside the container to the host of the container every time they are renewed.

These are just hypothesis, as with every option I tried, Safari blocks the connection not even giving an option to trust certificate manually.

0

There are 0 best solutions below