diff --git a/lib/https/index.js b/lib/https/index.js index f1385a179..818277b73 100644 --- a/lib/https/index.js +++ b/lib/https/index.js @@ -584,8 +584,8 @@ function resolveWebsocket(socket, wss) { } clearTimeout(timeout); var clientId = headers[config.CLIENT_ID_HEADER]; - if (clientId && !proxyUrl) { - if (!options.isPlugin && !socket._customClientId && !util.isKeepClientId(socket)) { + if (clientId) { + if (!options.isPlugin && !socket._customClientId && !util.isKeepClientId(socket, proxyUrl)) { socket._origClientId = clientId; util.removeClientId(headers); } diff --git a/lib/inspectors/res.js b/lib/inspectors/res.js index 51b10a2a4..9ced0e7dd 100644 --- a/lib/inspectors/res.js +++ b/lib/inspectors/res.js @@ -722,8 +722,8 @@ module.exports = function (req, res, next) { delete optHeaders['transfer-encoding']; } var clientId = optHeaders[config.CLIENT_ID_HEADER]; - if (clientId && !proxyUrl) { - if (!options.isPlugin && !req._customClientId && !util.isKeepClientId(req)) { + if (clientId) { + if (!options.isPlugin && !req._customClientId && !util.isKeepClientId(req, proxyUrl)) { req._origClientId = clientId; util.removeClientId(optHeaders); } diff --git a/lib/util/index.js b/lib/util/index.js index 0161b7e26..c75a7f42f 100644 --- a/lib/util/index.js +++ b/lib/util/index.js @@ -567,7 +567,7 @@ function isEnable(req, name) { exports.isEnable = isEnable; -exports.isKeepClientId = function(req) { +exports.isKeepClientId = function(req, proxyUrl) { if (isEnable(req, 'keepClientId')) { return true; } @@ -576,7 +576,7 @@ exports.isKeepClientId = function(req) { return false; } var enable = req.enable; - return enable.clientId || enable.clientID; + return enable.clientId || enable.clientID || proxyUrl; }; exports.getInternalHost = function (req, host) {