Caddy not responding to HTTPS

1. The problem I’m having:

The caddy server does not respond over https.
When using curl, on a http request we get a response but not when https is enabled. see 5. What is working:

Important: there is no logs being printed when using curl to http and https.

2. Error messages and/or full log output:

Logs when starting Caddy :

Aug 20 14:07:44 server systemd[1]: Starting Caddy...
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.591691,"msg":"maxprocs: Leaving GOMAXPROCS=8: CPU quota undefined"}
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.5917013,"msg":"GOMEMLIMIT is updated","GOMEMLIMIT":7381433548,"previous":9223372036854775807}
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.5917053,"msg":"using config from file","file":"/etc/caddy/caddy_config"}
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.5917084,"msg":"adapted config to JSON","adapter":"caddyfile"}
Aug 20 14:07:44 server caddy[29991]: {"level":"warn","ts":1787227664.591765,"logger":"admin","msg":"admin endpoint disabled"}
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.591978,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0x3d39a8589a00"}
Aug 20 14:07:44 server caddy[29991]: {"level":"warn","ts":1787227664.5922592,"logger":"http.auto_https","msg":"skipping automated certificate management for server because it is disabled","server_name":"srv0"}
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.5922675,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.592503,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.5926342,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
Aug 20 14:07:44 server caddy[29991]: {"level":"warn","ts":1787227664.592689,"logger":"http","msg":"HTTP/2 skipped because it requires TLS","network":"tcp","addr":":80"}
Aug 20 14:07:44 server caddy[29991]: {"level":"warn","ts":1787227664.5927072,"logger":"http","msg":"HTTP/3 skipped because it requires TLS","network":"tcp","addr":":80"}
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.5927098,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.5928411,"msg":"autosaved config (load with --resume flag)","file":"/var/lib/caddy/.config/caddy/autosave.json"}
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.592879,"msg":"serving initial configuration"}
Aug 20 14:07:44 server systemd[1]: Started Caddy.
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.5954576,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/var/lib/caddy/.local/share/caddy","instance":"f2fda046-c4c5-4f36-bf70-bee14a5e49d5","try_again":1787314064.5954564,"try_again_in":86399.99999977}
Aug 20 14:07:44 server caddy[29991]: {"level":"info","ts":1787227664.5954993,"logger":"tls","msg":"finished cleaning storage units"}

the curl command stays stuck for a while :

curl -vL ivanchtp.duckdns.org

*   Trying 90.127.113.99:80...
* Host ivanchtp.duckdns.org:80 was resolved.
* IPv6: (none)
* IPv4: 90.127.113.99
* Established connection to ivanchtp.duckdns.org (90.127.113.99 port 80) from 192.168.1.69 port 40876
* using HTTP/1.x
> GET / HTTP/1.1
> Host: ivanchtp.duckdns.org
> User-Agent: curl/8.21.0
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 308 Permanent Redirect
< Connection: close
< Location: https://ivanchtp.duckdns.org/
< Server: Caddy
< Date: Thu, 20 Aug 2026 12:14:14 GMT
< Content-Length: 0
<
* shutting down connection #0
* Issue another request to this URL: 'https://ivanchtp.duckdns.org/'
* Host ivanchtp.duckdns.org:443 was resolved.
* IPv6: (none)
* IPv4: 90.127.113.99
*   Trying 90.127.113.99:443...
* ALPN: curl offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* SSL Trust Anchors:
*   OpenSSL default paths (fallback)

before finishing the command like so :

* TLSv1.3 (OUT), TLS alert, decode error (562):
* TLS connect error: error:0A000126:SSL routines::unexpected eof while reading
* closing connection #1
curl: (35) TLS connect error: error:0A000126:SSL routines::unexpected eof while reading

Note: caddy should be listening to the ports. (redacting other services)

sudo netstat -tulpn

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 :::80                   :::*                    LISTEN      44539/caddy
tcp        0      0 :::443                  :::*                    LISTEN      44539/caddy
udp        0      0 :::443                  :::*                                44539/caddy

3. Caddy version:

2.11.4

4. How I installed and ran Caddy:

Nixos, Nixpkgs

a. System environment:

  • The certificates are generated with ACME by another module. they should be correct ?
  • Caddy is run using systemd.
  • Ports 443 and 80 are open on my server.
  • My router forwards port 80 with tcp over my server on port 80, port 443 with tcp or udp over my server on port 443.

b. Command:

sudo systemctl restart caddy

d. My complete Caddy config:

cat /etc/caddy/caddy_config

{
	auto_https disable_certs
    # is the email even needed ?
	email redacted_email_same_as_acme_email@gmail.com
	admin off

	log {
		level INFO
	}
}

ivanchtp.duckdns.org {
	tls /var/lib/acme/ivanchtp.duckdns.org/cert.pem /var/lib/acme/ivanchtp.duckdns.org/key.pem
	log {
		output file /var/log/caddy/access-ivanchtp.duckdns.org.log
	}

	respond "hello"
}

5. What is working:

when changing config file slightly :

cat /etc/caddy/caddy_config

{
	auto_https disable_certs
	email still_redacted@gmail.com
	admin off

	log {
		level INFO
	}
}

# NOTE: change is here v
http://ivanchtp.duckdns.org {
	log {
		output file /var/log/caddy/access-http:__ivanchtp.duckdns.org.log
	}

	respond "hello"
}

curl command is then working, which is expected. but when it is switched to https like in the previous config it doesnt work.

curl -vL ivanchtp.duckdns.org

* Host ivanchtp.duckdns.org:80 was resolved.
* IPv6: (none)
* IPv4: 90.127.113.99
*   Trying 90.127.113.99:80...
* Established connection to ivanchtp.duckdns.org (90.127.113.99 port 80) from 192.168.1.69 port 38630
* using HTTP/1.x
> GET / HTTP/1.1
> Host: ivanchtp.duckdns.org
> User-Agent: curl/8.21.0
> Accept: */*
>
* Request completely sent off
< HTTP/1.1 200 OK
< Content-Type: text/plain; charset=utf-8
< Server: Caddy
< Date: Thu, 20 Aug 2026 12:49:57 GMT
< Content-Length: 5
<
* Connection #0 to host ivanchtp.duckdns.org:80 left intact
hello

If you have ANY information I would be very happy. It’s been 2 days of tinkering.