Skip to content
Myr

Support multiple hosts in X-Forwarded-Host

Before adoption: this commit came in with the history the project adopted, so no landing records it.

fixes #3494 closes #3495

authored by Horatiu Eugen Vlad · committed by Douglas Christopher Wilson · parent 8da5110 · Browse files · 3 files+55 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+55 added−0 removed

  • tests:+50 added−0 removed
  • other:+5 added−0 removed

3 files+55 added−0 removed

modified:lib/request.js+4 added
428 unmodified lines
429 var host = this.get('X-Forwarded-Host');430431 if (!host || !trust(this.connection.remoteAddress, 0)) {432 host = this.get('Host');433 } else if (host.indexOf(',') !== -1) {434 // Note: X-Forwarded-Host is normally only ever a435 // single value, but this is to be safe.436 host = host.substring(0, host.indexOf(',')).trimRight()437 }438439 if (!host) return;440
85 unmodified lines
modified:test/req.hostname.js+50 added
modified:History.md+1 added
1 unmodified line
2==========34 * Improve error message for non-strings to `res.sendFile`5 * Improve error message for `null`/`undefined` to `res.status`6 * Support multiple hosts in `X-Forwarded-Host`784.16.4 / 2018-10-109===================10
3418 unmodified lines