traefik / traefik

The Cloud Native Application Proxy
https://traefik.io
MIT License
50k stars 4.99k forks source link

GeoIP HTTP Header #4868

Open Avalarion opened 5 years ago

Avalarion commented 5 years ago

Do you want to request a feature or report a bug?

Feature

What did you expect to see?

Currently we are running a lot of NGINX behind Traefik and all of those needs to check the users IP Addresses for Country, Region and City. This requires a lot of maintenance and file management and of course the work needs to be done at a lot of places.

A better approach would be to have Traefik handling this and forwarding those information as a header. This would reduce disk usage, maintenance and of course disk reads.

There is a GoLang Package for IP Lookup in a MaxMind Database that could be used: https://github.com/oschwald/geoip2-golang

Thanks for your time!

info2000 commented 5 years ago

could be open based in some configuration, maxmind provide different databases Per example, I have country database in one deployment and city+isp (2 maxmind files) in other deployment

joeldeteves commented 4 years ago

A better approach would be to have Traefik handling this and forwarding those information as a header. This would reduce disk usage, maintenance and of course disk reads.

If Traefik were able to perform a lookup against a GeoIP database, wouldn't it be even better to simply add a middleware that can block based on country code? This would be a very useful feature.

javabean commented 4 years ago

for GitHub keyword search: geolocation :-)

phuslu commented 4 years ago

I created fast inlined geoip lib in https://github.com/phuslu/geoip could help it

  1. fast ( ~ 30ns per call and 0 allocs)
  2. ipv6 support
  3. inlined ip2loc db (auto-update)

link to https://github.com/containous/traefik/issues/4026

bradenwright commented 3 years ago

I'm looking to redirect to diff endpoints based on GeoIP, or location. Is there a way to do this in Traefik2, we are using it as a K8s Ingress/IngressRoute deployed via Helm

kevinpollet commented 3 years ago

Hello all,

Take a look at the following plugin: https://pilot.traefik.io/plugins/276812028621881875/ip2location-plugin

PascalMinder commented 3 years ago

Hello all,

Take a look at the following plugin: https://pilot.traefik.io/plugins/276812028621881875/ip2location-plugin

This means one would have to buy the IP2Location IP-Country db for 49$ per year right?

fairok commented 2 years ago

I‘m also seeking this feature to add the response headers with country code via geoip2-lite. I had tried to install these plugins but failed. https://pilot.traefik.io/plugins/276812028621881875/ip2location-plugin https://pilot.traefik.io/plugins/60f1c49766d99f9d9f36c4ae/max-mind-geo-ip-2