diff --git a/lib/request.js b/lib/request.js index e7a451df6d9..d626423a2eb 100644 --- a/lib/request.js +++ b/lib/request.js @@ -424,7 +424,7 @@ defineGetter(req, 'host', function host(){ } else if (val.indexOf(',') !== -1) { // Note: X-Forwarded-Host is normally only ever a // single value, but this is to be safe. - val = val.substring(0, val.indexOf(',')).trimRight() + val = val.split(',', 1)[0].trimEnd(); } return val || undefined;