1. The problem I’m having:
I have a working caddy reverse proxy to my insecure grpc service written in golang
it’s working with SSL termination on caddy side
eg:
grpcurl -cacert certificate.pem 127.0.0.1:8443 list
but does not work when I use plaintext
grpcurl -plaintext 127.0.0.1:8443 list
Failed to dial target host "127.0.0.1:8443": context deadline exceeded
Caddy log reports about TLS handshake error even I’m not using any TLS certificate.
I tried auto_https disable_redirects and disable_certs , but it does not seem to make any difference.
I saw multiple examples on that forum when people used exactly the same config and plaintext worked. So it’s not clear why it happens. It’s much more convenient to test things without TLS using plaintext
2. Error messages and/or full log output:
2023/11/18 10:27:50.173 INFO using provided configuration {"config_file": "/home/sd/Build/ytdlp-ssh/cmd/caddy/Caddyfile", "config_adapter": ""}
2023/11/18 10:27:50.173 WARN Caddyfile input is not formatted; run 'caddy fmt --overwrite' to fix inconsistencies {"adapter": "caddyfile", "file": "/home/sd/Build/ytdlp-ssh/cmd/caddy/Caddyfile", "line": 2}
2023/11/18 10:27:50.174 INFO admin admin endpoint started {"address": "localhost:2019", "enforce_origin": false, "origins": ["//[::1]:2019", "//127.0.0.1:2019", "//localhost:2019"]}
2023/11/18 10:27:50.174 INFO http.auto_https server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS {"server_name": "srv0", "https_port": 8443}
2023/11/18 10:27:50.174 INFO http.auto_https enabling automatic HTTP->HTTPS redirects {"server_name": "srv0"}
2023/11/18 10:27:50.174 DEBUG http.auto_https adjusted config {"tls": {"automation":{"policies":[{}]}}, "http": {"http_port":8000,"https_port":8443,"servers":{"remaining_auto_https_redirects":{"listen":[":8000"],"routes":[{},{}]},"srv0":{"listen":[":8443"],"routes":[{"handle":[{"handler":"reverse_proxy","transport":{"protocol":"http","versions":["h2c","2"]},"upstreams":[{"dial":"127.0.0.1:5051"}]}]}],"tls_connection_policies":[{}],"automatic_https":{}}}}}
2023/11/18 10:27:50.174 INFO tls.cache.maintenance started background certificate maintenance {"cache": "0xc000546200"}
2023/11/18 10:27:50.174 INFO tls cleaning storage unit {"description": "FileStorage:/home/sd/.local/share/caddy"}
2023/11/18 10:27:50.174 INFO http enabling HTTP/3 listener {"addr": ":8443"}
2023/11/18 10:27:50.174 INFO tls finished cleaning storage units
2023/11/18 10:27:50.174 DEBUG http starting server loop {"address": "[::]:8443", "tls": true, "http3": true}
2023/11/18 10:27:50.174 INFO http.log server running {"name": "srv0", "protocols": ["h1", "h2", "h3"]}
2023/11/18 10:27:50.174 DEBUG http starting server loop {"address": "[::]:8000", "tls": false, "http3": false}
2023/11/18 10:27:50.174 INFO http.log server running {"name": "remaining_auto_https_redirects", "protocols": ["h1", "h2", "h3"]}
2023/11/18 10:27:50.174 INFO autosaved config (load with --resume flag) {"file": "/home/sd/.config/caddy/autosave.json"}
2023/11/18 10:27:50.174 INFO serving initial configuration
2023/11/18 10:27:55.529 DEBUG http.stdlib http: TLS handshake error from 127.0.0.1:42772: tls: first record does not look like a TLS handshake
2023/11/18 10:27:56.530 DEBUG http.stdlib http: TLS handshake error from 127.0.0.1:42788: tls: first record does not look like a TLS handshake
2023/11/18 10:27:58.066 DEBUG http.stdlib http: TLS handshake error from 127.0.0.1:42804: tls: first record does not look like a TLS handshake
2023/11/18 10:28:00.178 DEBUG http.stdlib http: TLS handshake error from 127.0.0.1:42818: tls: first record does not look like a TLS handshake
3. Caddy version:
2.7.5/devel version
4. How I installed and ran Caddy:
Linux binary / Run from sources
a. System environment:
Debian 12 amd64
Caddy run directly on the host
b. Command:
./caddy_linux_amd64 run --config Caddyfile
c. Service/unit/compose file:
None
d. My complete Caddy config:
{
debug
https_port 8443
http_port 8000
}
:8443 {
reverse_proxy h2c://127.0.0.1:5051
}
5. Links to relevant resources:
None