Skip to content
Myr

Fix req.host when using "trust proxy" hops count

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

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 20aa126 · Browse files · 3 files+20 added−1 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+20 added−1 removed

  • tests:+18 added−0 removed
  • other:+2 added−1 removed

3 files+20 added−1 removed

modified:lib/request.js+1 added-1 removed
489 unmodified lines
490req.__defineGetter__('host', function(){491 var trust = this.app.get('trust proxy fn');492 var host = this.get('X-Forwarded-Host');493494 if (!host || !trust(this.connection.remoteAddress)) {494 if (!host || !trust(this.connection.remoteAddress, 0)) {495 host = this.get('Host');496 }497498 if (!host) return;
60 unmodified lines
modified:test/req.host.js+18 added
modified:History.md+1 added
13.x2===34 * Fix `req.host` when using "trust proxy" hops count5 * Fix `req.protocol`/`req.secure` when using "trust proxy" hops count673.20.0 / 2015-02-188===================
1989 unmodified lines