diff --git a/lib/index.js b/lib/index.js
index <HASH>..<HASH> 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -38,7 +38,7 @@ function tunnelProxy(server, proxy) {
 	
 	process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
 	server.on('connect', function(req, reqSocket, head) {//ws, wss, https proxy
-		var tunnelUrl = req.fullUrl = util.setProtocol(/^[^:\/]+:\d+$/ ? req.url : req.headers.host, true);
+		var tunnelUrl = req.fullUrl = util.setProtocol(/^[^:\/]+:\d+$/.test(req.url) ? req.url : req.headers.host, true);
 		var options = parseUrl();
 		var tunnelUrl = req.fullUrl = 'tunnel://' + options.host;
 		var resSocket, proxySocket, responsed;
refactor: Priority handling req.url