From ee29b28156a998b39296d4beed5b8c0818b2840a Mon Sep 17 00:00:00 2001 From: cclohmar Date: Fri, 10 Jul 2026 12:03:37 +0100 Subject: [PATCH] fix: add time import for net.DialTimeout --- main.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index c32f53f..7e10010 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "html/template" "io" "log" + "net" "net/http" "net/http/httputil" "net/url" @@ -14,6 +15,7 @@ import ( "path/filepath" "strconv" "strings" + "time" "gopkg.in/yaml.v3" ) @@ -295,9 +297,10 @@ func adminHandler(w http.ResponseWriter, r *http.Request) { resp.Body.Close() } caddyUp := false - if resp, err := http.Get("http://127.0.0.1:80/"); err == nil { + // Check port 80 responds (don't follow HTTPS redirect) + if conn, err := net.DialTimeout("tcp", "127.0.0.1:80", 3*time.Second); err == nil { caddyUp = true - resp.Body.Close() + conn.Close() } launcherUp := false if resp, err := http.Get("http://127.0.0.1:9000/health"); err == nil {