Caddy won't serve a specific subdomain

1. Caddy version (caddy version):

latest caddy version

2. How I run Caddy:

I use this docker compose

#docker-compose.yml
version: "3.7"
services:
  back:
    build:
      context: ./backend/
      dockerfile: Dockerfile
  front:
    build:
      context: ./FrontEnd/
      dockerfile: Dockerfile
  server-ssl-front:
    image: caddy:latest  
    restart: unless-stopped
    depends_on:
      - front
      - back  
    links:
      - back
      - front
    ports:
      - '80:80' 
      - '443:443'
      - '3000:3000'
    volumes:
      #- ./.caddy:/root/.caddy
      - ./Caddyfile:/etc/caddy/Caddyfile
      - caddy_data:/data
      - caddy_config:/config
volumes:
        caddy_data:
        caddy_config:

a. System environment:

Ubuntu 20.04.3 and I use docker

b. Command:

docker-compose up

c. My complete Caddyfile or JSON config:

{
    email ethan.villesseche@harx.ai
    acme_ca https://acme-v02.api.letsencrypt.org/directory
}

uat.harx.ai {
    reverse_proxy front:3000
}
uat.harx.ai:3000 {
    reverse_proxy back:3000
}

3. The problem I’m having:

Caddy won’t serve on this specific subdomain since I have another caddy server running for another subdomain and it works (same config)

4. Error messages and/or full log output:

server-ssl-front_1  | {"level":"warn","ts":1657530883.204135,"msg":"exiting; byeee!! 👋","signal":"SIGTERM"}
server-ssl-front_1  | {"level":"info","ts":1657530883.3459246,"logger":"tls.cache.maintenance","msg":"stopped background certificate maintenance","cache":"0xc0004d8ee0"}
server-ssl-front_1  | {"level":"info","ts":1657530883.3471806,"logger":"admin","msg":"stopped previous server","address":"tcp/localhost:2019"}
server-ssl-front_1  | {"level":"info","ts":1657530883.3472226,"msg":"shutdown complete","signal":"SIGTERM","exit_code":0}
server-ssl-front_1  | {"level":"info","ts":1657530922.6738641,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
server-ssl-front_1  | {"level":"info","ts":1657530922.6760178,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
server-ssl-front_1  | {"level":"info","ts":1657530922.676249,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
server-ssl-front_1  | {"level":"info","ts":1657530922.676365,"logger":"http","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv1","https_port":443}
server-ssl-front_1  | {"level":"info","ts":1657530922.6763897,"logger":"http","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv1"}
server-ssl-front_1  | {"level":"info","ts":1657530922.6768825,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000109110"}
server-ssl-front_1  | {"level":"info","ts":1657530922.6773362,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["uat.harx.ai"]}
server-ssl-front_1  | {"level":"info","ts":1657530922.6776376,"logger":"tls","msg":"cleaning storage unit","description":"FileStorage:/data/caddy"}
server-ssl-front_1  | {"level":"info","ts":1657530922.6785994,"logger":"tls","msg":"finished cleaning storage units"}
server-ssl-front_1  | {"level":"info","ts":1657530922.6794434,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
server-ssl-front_1  | {"level":"info","ts":1657530922.6794596,"msg":"serving initial configuration"}
server-ssl-front_1  | {"level":"error","ts":1657530999.2867746,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"context canceled"}
server-ssl-front_1  | {"level":"error","ts":1657531003.44116,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"context canceled"}
server-ssl-front_1  | {"level":"error","ts":1657531014.3504026,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"context canceled"}
server-ssl-front_1  | {"level":"error","ts":1657531021.110216,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"context canceled"}
server-ssl-front_1  | {"level":"error","ts":1657531042.8873534,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"context canceled"}
server-ssl-front_1  | {"level":"error","ts":1657531137.1161242,"logger":"http.handlers.reverse_proxy","msg":"reading from backend","error":"unexpected EOF"}
server-ssl-front_1  | {"level":"error","ts":1657531137.116248,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"unexpected EOF"}
server-ssl-front_1  | {"level":"error","ts":1657531141.6432667,"logger":"http.log.error","msg":"dial tcp: lookup front on 127.0.0.11:53: server misbehaving","request":{"remote_ip":"78.192.234.206","remote_port":"55034","proto":"HTTP/2.0","method":"GET","host":"uat.harx.ai","uri":"/auth/login","headers":{"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"],"Accept-Language":["fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"],"Accept-Encoding":["gzip, deflate, br"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Site":["none"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0"],"Te":["trailers"],"Sec-Fetch-User":["?1"],"If-None-Match":["\"2vdble\""]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"uat.harx.ai"}},"duration":0.028465494,"status":502,"err_id":"tw9ytigy0","err_trace":"reverseproxy.statusError (reverseproxy.go:1166)"}
server-ssl-front_1  | {"level":"error","ts":1657531183.5568302,"logger":"http.handlers.reverse_proxy","msg":"reading from backend","error":"unexpected EOF"}
server-ssl-front_1  | {"level":"error","ts":1657531183.5569515,"logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","error":"unexpected EOF"}

5. What I already tried:

Just restarting both my caddy server and only one works

Are you sure?

Run docker-compose exec server-ssl-front caddy version to check.

You don’t need to specify this, btw.

That’s not an issue with Caddy. Your DNS resolver (Docker) gave a bad response for some reason.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.