Skip to content

Commit

Permalink
clarify resulting action on failed parse and remove some self-explana…
Browse files Browse the repository at this point in the history
…tory comments
  • Loading branch information
Aaron Hurt committed Feb 27, 2018
1 parent 3bfe186 commit a1d7b54
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions route/access_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,14 @@ func (t *Target) AccessDeniedHTTP(r *http.Request) bool {
// https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/x-forwarded-headers.html#x-forwarded-for
// See lengthy github discussion for more background: https://github.com/fabiolb/fabio/pull/449
for _, xip := range strings.Split(xff, ",") {
// ensure we only get the ip string
xip = strings.TrimSpace(xip)
// only continue if xip differs from host
if xip == host {
continue
}
if ip = net.ParseIP(xip); ip == nil {
log.Printf("[WARN] failed to parse xff address %s", xip)
continue
}
// check xff source and return if denied
if t.denyByIP(ip) {
return true
}
Expand Down

0 comments on commit a1d7b54

Please sign in to comment.