From e0f8d9b2047af417d8faf354b675941f3dac9891 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 3 Feb 2026 13:59:53 -0700 Subject: [PATCH] caddytls: Check type assertion Fix https://github.com/mholt/caddy-l4/issues/378 --- modules/caddytls/capools.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/caddytls/capools.go b/modules/caddytls/capools.go index bcc9ec6e8..55abb7466 100644 --- a/modules/caddytls/capools.go +++ b/modules/caddytls/capools.go @@ -502,8 +502,8 @@ func (t *TLSConfig) unmarshalCaddyfile(d *caddyfile.Dispenser) error { // If there is no custom TLS configuration, a nil config may be returned. // copied from with minor modifications: modules/caddyhttp/reverseproxy/httptransport.go func (t *TLSConfig) makeTLSClientConfig(ctx caddy.Context) (*tls.Config, error) { - repl, _ := ctx.Value(caddy.ReplacerCtxKey).(*caddy.Replacer) - if repl == nil { + repl, ok := ctx.Value(caddy.ReplacerCtxKey).(*caddy.Replacer) + if !ok || repl == nil { repl = caddy.NewReplacer() } cfg := new(tls.Config)