Hello all,
I am completely new to Traefik and I am playing with a Traefik handling automatic TLS configuration with Let's Encrypt in my Kamal setup.
My setup essentially works but with one caveat. Requesting the domain name from within the docker container running behind Traefik fails:
Failed to open TCP connection to domainname.com:443 (Connection refused - connect(2) for "domainname.com" port 443) (Errno::ECONNREFUSED)
Basically everything works as expected except going to the container and requesting the domain name under which it runs. It won't resolve.
Here's my Traefik config:
traefik:
options:
publish:
- "80:80"
- "443:443"
volume:
- "/letsencrypt/acme.json:/letsencrypt/acme.json"
network: "private"
args:
entryPoints.web.address: ":80"
entryPoints.websecure.address: ":443"
certificatesResolvers.letsencrypt.acme.email: "support@domainname"
certificatesResolvers.letsencrypt.acme.storage: "/letsencrypt/acme.json"
certificatesResolvers.letsencrypt.acme.httpchallenge: true
certificatesResolvers.letsencrypt.acme.httpchallenge.entrypoint: web
And container labels:
servers:
web:
hosts:
- 165.227.160.200
labels:
traefik.http.routers.domainname.rule: Host(`domainname.com`)
traefik.http.routers.domainname.entrypoints: web
traefik.http.routers.domainname_secure.entrypoints: websecure
traefik.http.routers.domainname_secure.rule: Host(`domainname.com`)
traefik.http.routers.domainname_secure.tls: true
traefik.http.routers.domainname_secure.tls.certresolver: letsencrypt
options:
network: "private"
It's Kamal syntax but I think the arguments and labels are the same.
Anyone having an idea how to make Traefik to resolve the domain to the container if the request origins from within the said container?
Thank you all.