fix: default wss port will cause service close

This commit is contained in:
silentcloud 2018-12-17 19:27:45 +08:00 committed by xiaofeng.mxf
parent 68188c9cd6
commit e003c887fa

View File

@ -710,7 +710,8 @@ function getWsHandler(userRule, recorder, wsClient, wsReq) {
}; };
const clientMsgQueue = []; const clientMsgQueue = [];
const serverInfo = getWsReqInfo(wsReq); const serverInfo = getWsReqInfo(wsReq);
const wsUrl = `${serverInfo.protocol}://${serverInfo.hostName}:${serverInfo.port}${serverInfo.path}`; const serverInfoPort = serverInfo.port ? `:${serverInfo.port}` : '';
const wsUrl = `${serverInfo.protocol}://${serverInfo.hostName}${serverInfoPort}${serverInfo.path}`;
const proxyWs = new WebSocket(wsUrl, '', { const proxyWs = new WebSocket(wsUrl, '', {
rejectUnauthorized: !self.dangerouslyIgnoreUnauthorized, rejectUnauthorized: !self.dangerouslyIgnoreUnauthorized,
headers: serverInfo.noWsHeaders headers: serverInfo.noWsHeaders