Trimming whitespace in XFF for IP whitelisting
This commit is contained in:
parent
4cb1ae4626
commit
44e06a1a1e
2 changed files with 4 additions and 3 deletions
|
@ -63,7 +63,8 @@ func (ip *IP) IsAuthorized(req *http.Request) error {
|
|||
for _, xFF := range xFFs {
|
||||
xffs := strings.Split(xFF, ",")
|
||||
for _, xff := range xffs {
|
||||
ok, err := ip.contains(parseHost(xff))
|
||||
xffTrimmed := strings.TrimSpace(xff)
|
||||
ok, err := ip.contains(parseHost(xffTrimmed))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -72,7 +73,7 @@ func (ip *IP) IsAuthorized(req *http.Request) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
invalidMatches = append(invalidMatches, xff)
|
||||
invalidMatches = append(invalidMatches, xffTrimmed)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue