Skip to content

Commit

Permalink
f
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-horse committed Apr 11, 2019
1 parent 59f9b51 commit 101d2ee
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/extend/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ module.exports = {
const val = getFromHeaders(this, this.app.config.ipHeaders) || '';
this[IPS] = val ? val.split(/\s*,\s*/) : [];

// if maxProxyCount present, only keep `maxProxyCount + 1` ips
// [ illegalIp, clientRealIp, proxyIp1, proxyIp2 ...]
if (this.app.config.maxProxyCount > 0) this[IPS] = this[IPS].slice(-(this.app.config.maxProxyCount + 1));
if (this.app.config.maxProxyCount > 0) {
// if maxProxyCount present, only keep `maxProxyCount + 1` ips
// [ illegalIp, clientRealIp, proxyIp1, proxyIp2 ...]
this[IPS] = this[IPS].slice(-(this.app.config.maxProxyCount + 1));
}
return this[IPS];
},

Expand Down

0 comments on commit 101d2ee

Please sign in to comment.