captncraig / caddy-realip

Real-IP middleware for caddy
MIT License
18 stars 9 forks source link

Need to account for whitespace #11

Closed sporkmonger closed 7 years ago

sporkmonger commented 7 years ago

Currently the plugin splits on commas, but doesn't account for the possibility of whitespace, which is quite common in the X-Forwarded-For header. This results in trying to parse an IP address with leading whitespace, which then fails, despite the IP address being valid.

captncraig commented 7 years ago

I'd rather implement this by using strings.Trim on each segment rather than reverting to regexp.

sporkmonger commented 7 years ago

Fair enough, I'll update PR.

sporkmonger commented 7 years ago

Done.

slightfoot commented 7 years ago

/nudge/ @captncraig.. Any chance of getting this change merged in? I issue just occurred for myself.