Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support config.maxProxyCount to help get the real client ip #3612

Merged
merged 5 commits into from Apr 11, 2019

Conversation

dead-horse
Copy link
Member

No description provided.

@dead-horse
Copy link
Member Author

@popomore 先看这个,在 egg 层支持吧,我等下补个文档把代理相关的配置都说明一下。

@dead-horse dead-horse changed the title feat: support config.maxProxyCount to help get the real client ip [WIP]feat: support config.maxProxyCount to help get the real client ip Apr 11, 2019
@dead-horse dead-horse changed the title [WIP]feat: support config.maxProxyCount to help get the real client ip feat: support config.maxProxyCount to help get the real client ip Apr 11, 2019

// if maxProxyCount present, only keep `maxProxyCount + 1` ips
// [ illegalIp, clientRealIp, proxyIp1, proxyIp2 ...]
if (this.app.config.maxProxyCount) this[IPS] = this[IPS].slice(-(this.app.config.maxProxyCount + 1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.app.config.maxProxyCount > 0

这样就不用做类型判断了

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@codecov
Copy link

codecov bot commented Apr 11, 2019

Codecov Report

Merging #3612 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #3612   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files          32      32           
  Lines         919     921    +2     
======================================
+ Hits          919     921    +2
Impacted Files Coverage Δ
config/config.default.js 100% <ø> (ø) ⬆️
app/extend/request.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2357fbc...4b20362. Read the comment docs.

@dead-horse dead-horse merged commit 01b9588 into master Apr 11, 2019
@dead-horse dead-horse deleted the fix-client-ip branch April 11, 2019 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants