9seconds / topographer

Self-hosted lenient geoip service
MIT License
28 stars 4 forks source link

X-Forwarded-For or X-Real-Ip support? #17

Open dawnerd opened 3 years ago

dawnerd commented 3 years ago

Heya, this project looks great so gave it a shot, tossed it behind a reverse proxy and turns out it doesn't grab the correct IP - less than ideal. Just wondering if those headers could be checked as well instead of just relying on RemoteAddr

9seconds commented 3 years ago

Hey! Yes, sure, this is absolutely possible. Take a look: https://github.com/9seconds/topographer/blob/master/main.go#L68-L82 an instance of Topographer is http.Handler so if you use it as a library, you can already wrap it in some middleware. But CLI app does not have it, you are right. I'll implement it this week.