Quick Fix c.ClientIP() Parse Error for TrustedProxies feature & NoMethod annotation#2832
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2832 +/- ##
=======================================
Coverage 98.75% 98.75%
=======================================
Files 41 41
Lines 3062 3063 +1
=======================================
+ Hits 3024 3025 +1
Misses 26 26
Partials 12 12
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
@menduo @zihengCat Please leave your review here to help fix this as soon as possible. This change will parse TrustedProxies and trust all proxies by default. |
|
@thinkerou @appleboy code review plz |
|
@Bisstocuz I gave the comment. |
directly initialization
|
@junikaii @menduo I think that directly giving it a absolute default value is more consistent. @xpunch mentioned this in #2692 :
This value means trust all IPs by default. |
directly initialization
gin.ListenAndServe doesn't support trusted proxies and ClientIP doesn't work bump gin down to 1.6.2 to mitigate temporarily will update gin once gin-gonic/gin#2832 is merged
|
@appleboy Hi, code review plz. After this PR merged, I will do some works and create a new PR to perfect
|
|
@thinkerou need your approval. |
zihengCat
left a comment
There was a problem hiding this comment.
Nice solution, make trustedCIDRs pass all IP addresses by changing its default value.
|
@Bisstocuz Could you make all CI unit tests passed? |
@zihengCat I'm checking it. This seems to have something to do with #2872 |
|
@appleboy @zihengCat @thinkerou @junikaii |
…ng r.Run() to run http server (#2832)
…ng r.Run() to run http server (gin-gonic#2832) (cherry picked from commit 6d75aba)
…ng r.Run() to run http server (gin-gonic#2832) (cherry picked from commit 6d75aba)
…ng r.Run() to run http server (gin-gonic#2832) (cherry picked from commit 6d75aba)
…ng r.Run() to run http server (gin-gonic#2832) (cherry picked from commit 6d75aba)
…ng r.Run() to run http server (#2832)
…ng r.Run() to run http server (gin-gonic#2832) (cherry picked from commit 6d75aba)
…ng r.Run() to run http server (#2832)
…ng r.Run() to run http server (#2832)
…ng r.Run() to run http server (gin-gonic#2832)
Related issues: #2791 #2697 #2814
Someone who not using
r.Run()to run http server may meet this issue:c.ClientIP()always returns the same IP for all clients because of calling ofprepareTrustedCIDRs()ofTrustedProxiesfeature.For example,
c.ClientIP()always returns127.0.0.1while using local reverse proxy.In
New(): there is one definition:TrustedProxies: []string{"0.0.0.0/0"}We can see this variable has default value, but
trustedCIDRsdoesn't have.So we just need to give a default value to
trustedCIDRs.