tls: only redirect to HTTPS if host is known
1 file changed, 5 insertions(+), 1 deletion(-)
jump to
M internal/server/tls.go → internal/server/tls.go
@@ -131,7 +131,11 @@ host = r.Host } url.Host = net.JoinHostPort(host, s.config.BaseURL.Port()) } - http.Redirect(w, r, url.String(), http.StatusMovedPermanently) + if slices.Contains(s.config.Domains, r.Host) { + http.Redirect(w, r, url.String(), http.StatusMovedPermanently) + } else { + http.NotFound(w, r) + } }) srv.Handler = httpMux