r.GET("/console", func(c *gin.Context) {
// Call the Proxmox API to get the console ticket
console, err := PveClient.GetVMConsole("pve", 1005)
if err != nil {
c.JSON(500, gin.H{"error": "Failed to get console"})
fmt.Printf("Failed to get console: %v\n", err)
return
}
// Constructing a redirect URL
vncPath := fmt.Sprintf(
"wss://%s:8006/nodes/%s/qemu/%d/vncwebsocket?port=%s&vncticket=%s",
"pve.bbccaa.org",
"pve",
100,
console.Port,
url.QueryEscape(console.Ticket),
)
fmt.Printf("VNC Path: %s\n", vncPath)
fullURL := "/novnc/vnc.html?autoconnect=true&path=" + url.QueryEscape(vncPath)
c.Redirect(http.StatusFound, fullURL)
})
I have obtained all the parameters normally, but my noVNC still cannot connect, and the websocket returns a 1006 error
rfb.js:968 Failed when connecting: Connection closed (code: 1006)
wss://pve.aaccbb.org:8006/nodes/pve/qemu/100/vncwebsocket?port=5900&vncticket=PVEVNC%3A685232CC%3A%3Ai4nbAWJipbyRJ92L4MClZBnRcLVvqwodPs4GD1MemqCAIMbmSFP1UV%2B5RyoTgpFniQ1%2BMEEGrBUGGegFd35bxZiW0rjyAHyVZKUlRbQ3nU6ORTcNKAs0G%2Byec99zR%2F%2B5rQluoRkEvmXxbbVpVA7lmUdFGBRFcFhzbYQDHK6gk2z42SiMlRZSVLxbhSc4hsF8f8aFN%2Fd0l23kO2kWqBsIViT4QIu5TV5shNuARNNGZ8kyGTzqvGk7l6ZbOUlpx2XnB98sQI4CsVF0krCa6NvrWMH52lObuzpEtnzQJytzMvH97gttOzcIL4HSMl3ERPfpI0h8s5HlKBQDaUGSXnJtiA%3D%3D
My domain name certificate is valid, and the port test using telnet is also passed.
root@pve:~# ss -lntp |grep 5900
LISTEN 0 1 0.0.0.0:5900 0.0.0.0:* users
("task UPID
ve:0",pid=95139,fd=6))
It is also normal. I don't know why I can't connect. How can I solve it?
// Call the Proxmox API to get the console ticket
console, err := PveClient.GetVMConsole("pve", 1005)
if err != nil {
c.JSON(500, gin.H{"error": "Failed to get console"})
fmt.Printf("Failed to get console: %v\n", err)
return
}
// Constructing a redirect URL
vncPath := fmt.Sprintf(
"wss://%s:8006/nodes/%s/qemu/%d/vncwebsocket?port=%s&vncticket=%s",
"pve.bbccaa.org",
"pve",
100,
console.Port,
url.QueryEscape(console.Ticket),
)
fmt.Printf("VNC Path: %s\n", vncPath)
fullURL := "/novnc/vnc.html?autoconnect=true&path=" + url.QueryEscape(vncPath)
c.Redirect(http.StatusFound, fullURL)
})
I have obtained all the parameters normally, but my noVNC still cannot connect, and the websocket returns a 1006 error
rfb.js:968 Failed when connecting: Connection closed (code: 1006)
wss://pve.aaccbb.org:8006/nodes/pve/qemu/100/vncwebsocket?port=5900&vncticket=PVEVNC%3A685232CC%3A%3Ai4nbAWJipbyRJ92L4MClZBnRcLVvqwodPs4GD1MemqCAIMbmSFP1UV%2B5RyoTgpFniQ1%2BMEEGrBUGGegFd35bxZiW0rjyAHyVZKUlRbQ3nU6ORTcNKAs0G%2Byec99zR%2F%2B5rQluoRkEvmXxbbVpVA7lmUdFGBRFcFhzbYQDHK6gk2z42SiMlRZSVLxbhSc4hsF8f8aFN%2Fd0l23kO2kWqBsIViT4QIu5TV5shNuARNNGZ8kyGTzqvGk7l6ZbOUlpx2XnB98sQI4CsVF0krCa6NvrWMH52lObuzpEtnzQJytzMvH97gttOzcIL4HSMl3ERPfpI0h8s5HlKBQDaUGSXnJtiA%3D%3D

My domain name certificate is valid, and the port test using telnet is also passed.
root@pve:~# ss -lntp |grep 5900
LISTEN 0 1 0.0.0.0:5900 0.0.0.0:* users


It is also normal. I don't know why I can't connect. How can I solve it?