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
Conversation
@popomore 先看这个,在 egg 层支持吧,我等下补个文档把代理相关的配置都说明一下。 |
app/extend/request.js
Outdated
|
||
// 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)); |
There was a problem hiding this comment.
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
这样就不用做类型判断了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Codecov Report
@@ Coverage Diff @@
## master #3612 +/- ##
======================================
Coverage 100% 100%
======================================
Files 32 32
Lines 919 921 +2
======================================
+ Hits 919 921 +2
Continue to review full report at Codecov.
|
101d2ee
to
54486c7
Compare
No description provided.