diff --git a/test/req.host.js b/test/req.host.js index cdda82eaae3..ce9879c8026 100644 --- a/test/req.host.js +++ b/test/req.host.js @@ -135,6 +135,22 @@ describe('req', function(){ .expect('example.com', done); }) }) + + it('should use first value when X-Forwarded-Host has comma', function (done) { + var app = express(); + + app.enable('trust proxy'); + + app.use(function (req, res) { + res.end(req.host); + }); + + request(app) + .get('/') + .set('Host', 'localhost') + .set('X-Forwarded-Host', 'example.com, foobar.com') + .expect('example.com', done); + }) }) describe('when "trust proxy" is disabled', function(){