Using GeoIP Functionality in Varnish

Ken Brownfield kb+varnish at slide.com
Tue Mar 16 22:00:30 CET 2010


MaxMind has several different databases; the database that is the only one supported by most GeoIP "plugins" is Country, which can only map an IP to a country.  The City edition can map IPs to cities, zip codes, latitude/longitude, etc..

The plugin you mention does require the City edition, but MaxMind has a free, less accurate GeoLite City DB.  The City DB will provide country as well as the finer granularity, so for your purposes (country only) it's fine.

I do like the custom header idea, mainly because you can potentially pass the header to a backend for possible processing, but also because the conditionals are easier in VCL.

There are a lot of cool things you can do with the City DB beyond static mappings (see bind-geoip on Google Code) that would be cool to see in cosimo/varnish-geoip.
-- 
kb

On Mar 16, 2010, at 1:07 PM, Sebastian Cabrera wrote:

> Hi everybody,
> 
> i just replied to my own request, because i could not make a decision
> whom to write back :)
> 
> You all gave me some very good ideas, i have to discuss them with my
> collegues. I also had a look at http://github.com/cosimo/varnish-geoip/,
> but also read something about the need to have the "city edition of
> GeoIP" and was not sure what this could mean.
> 
> thank you very much,
> regards,
> 
> Sebastian
> 
> On 03/16/2010 05:22 PM, Sebastian Cabrera wrote:
>> Hi everybody,
>> 
>> On a Website i want to have the posibility to do some rewriting due to
>> the Country he's comming from. So if someone visits the Mainpage
>> (domain.com) from US i want to have him visiting domain.com/us/.
>> Does anyone have any experiences with that? How can i do this?
>> I just downloaded and installed the GeoIP Plugin from the varnish wiki
>> (http://varnish-cache.org/wiki/GeoipUsingInlineC), but how can i use it?
>> Is there any possibility to do something like
>> 
>> if (get_country_code(client.ip) == "US") {
>>   set req.url = "/us/"
>> }
>> 
>> ?
>> 
>> thanks for your help,
>> regards,
>> 
>> Sebastian
>> 
>> _______________________________________________
>> varnish-misc mailing list
>> varnish-misc at varnish-cache.org
>> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
> 
> 
> -- 
> A: Yes.
>> Q: Are you sure?
>>> A: Because it reverses the logical flow of conversation.
>>>> Q: Why is top posting frowned upon?
> 
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> http://lists.varnish-cache.org/mailman/listinfo/varnish-misc

-- 
kb





More information about the varnish-misc mailing list