fix(agent): validate HUB_URL host to prevent misleading "lookup api" DNS error (#2011)

This commit is contained in:
Sven van Ginkel
2026-08-13 19:25:12 -04:00
committed by GitHub
parent 35af36fbd2
commit fa5cda83c2
+2 -2
View File
@@ -53,8 +53,8 @@ func newWebSocketClient(agent *Agent) (client *WebSocketClient, err error) {
client = &WebSocketClient{}
client.hubURL, err = url.Parse(hubURLStr)
if err != nil {
return nil, errors.New("invalid hub URL")
if err != nil || client.hubURL.Host == "" {
return nil, fmt.Errorf("invalid HUB_URL %q: must include scheme and host (e.g. http://hub.example.com:8090)", hubURLStr)
}
// get registration token
client.token, err = getToken()