Move ssl/tls related error to debug loglevel, to avoid log cluttering.

This commit is contained in:
eleksir
2026-04-04 13:16:17 +03:00
parent 14b7a17b00
commit 958ef67f29
5 changed files with 162 additions and 14 deletions

View File

@@ -257,6 +257,16 @@ Checks `X-Forwarded-For` header first (for proxied requests), then falls back to
- `WriteTimeout`: configurable via `backup_timeout` (converted to `time.Duration`)
- TLS minimum version: TLS 1.3 (when HTTPS enabled)
### TLS Error Handling
The server uses a `serverWrapper` type to intercept and classify errors from `Serve()` and `ServeTLS()`. TLS-specific errors are logged at debug level to reduce log clutter:
- Uses `errors.As` to detect TLS error types: `tls.AlertError`, `tls.CertificateVerificationError`, `tls.ECHRejectionError`, `tls.RecordHeaderError`
- Also checks for "tls:" prefix in error messages
- Additionally uses `http.Server.ErrorLog` with a custom logger that writes at debug level for net/http's internal TLS-related messages
This ensures client-side TLS errors (handshake failures, certificate issues) don't clutter production logs.
## Dependencies
- `github.com/hjson/hjson-go` v3.3.0 — HJSON config parsing