IMO, implement geo_ip as plugin is better, not in the route.

And https://luarocks.org/modules/agladysh/lua-geoip is not a good approach,
lua-resty-maxminddb[1] is good for APISIX.

[1] https://github.com/anjia0532/lua-resty-maxminddb

Thanks,
Ming Wen, Apache APISIX & Apache SkyWalking
Twitter: _WenMing


JinChao Shuai <[email protected]> 于2020年8月6日周四 上午1:47写道:

> I also agree with the second approach and to `Yansheng Wang` that users can
> use their own GeoIP database.
>
> YuanSheng Wang <[email protected]> 于2020年8月5日周三 下午11:40写道:
>
> > Of course, the second way is better for APISIX.
> >
> > The `lua-geoip` is under Dual license, we need to confirm if we can use
> > this library.
> >
> > The users needs to download the GeoIP database by himself, Apache APISIX
> > can
> > not ship with the GeoIP data(under LGPL 2.1).
> >
> >
> > On Wed, Aug 5, 2020 at 9:16 PM Li Ling(Lien) <[email protected]> wrote:
> >
> > > rencently I am thinking about have Geo routing in APISIX,
> > > scenario:
> > >     1、I want route user‘s request from country request intoto different
> > > upstream host.
> > >     2、When users from outside China redirect to international
> > homepage(many
> > > video sites like youku.com they ban users from outside china).
> > >
> > >
> > > here is two solution I digged into:
> > >
> > > 1、intergrate nginx module
> https://github.com/leev/ngx_http_geoip2_module
> > > and
> > > do variable matching.
> > >      disadvantage: we need calculate the geo data from ip info for
> every
> > > request,which is so inefficient.
> > >
> > >
> > > 2、https://luarocks.org/modules/agladysh/lua-geoip
> > >      intergrate this lua module into lua-resty-radixtree, when geo_ip_*
> > > parameter is set in the routes, we calculate the ip country info from
> > geoip
> > > library.so  that  it wont calculate the geo data for each request.
> > >
> >
> >
> > --
> >
> > *MembPhis*
> > My GitHub: https://github.com/membphis
> > Apache APISIX: https://github.com/apache/incubator-apisix
> >
>
>
> --
> Thanks,
> Janko
>

Reply via email to