diff --git a/nodes/core/58-debug.html b/nodes/core/58-debug.html
index acd9c1047..38ed9f615 100644
--- a/nodes/core/58-debug.html
+++ b/nodes/core/58-debug.html
@@ -114,7 +114,7 @@
function debugConnect() {
//console.log("debug ws connecting");
var path = location.hostname+":"+location.port+document.location.pathname;
- path = path+(path.slice(-1) == "/"?"":"/")+"debug";
+ path = path+(path.slice(-1) == "/"?"":"/")+"debug/ws";
path = "ws"+(document.location.protocol=="https:"?"s":"")+"://"+path;
var ws = new WebSocket(path);
ws.onopen = function() {
diff --git a/nodes/core/58-debug.js b/nodes/core/58-debug.js
index 54df66129..67c3c36f4 100644
--- a/nodes/core/58-debug.js
+++ b/nodes/core/58-debug.js
@@ -79,7 +79,11 @@ DebugNode.send = function(msg) {
}
DebugNode.activeConnections = [];
-DebugNode.wsServer = new ws.Server({server:RED.server});
+
+var path = RED.settings.httpRoot || "/";
+path = path + (path.slice(-1) == "/" ? "":"/") + "debug/ws";
+
+DebugNode.wsServer = new ws.Server({server:RED.server,path:path});
DebugNode.wsServer.on('connection',function(ws) {
DebugNode.activeConnections.push(ws);
ws.on('close',function() {