varnish 5 vmod for geoip country lookup

Admin Beckspaced admin at beckspaced.com
Fri Oct 28 20:05:39 CEST 2016


hello varnish users,

is there a working, up-to-date, vmod for varnish 5 which gives me a 
country code based on the client ip address?

so i could do things like described in the docs:

https://www.varnish-cache.org/docs/trunk/users-guide/vcl-hashing.html

In vcl_recv:

set req.http.X-Country-Code = geoip.lookup(client.ip);

And then add a vcl_hash:

sub vcl_hash {
     hash_data(req.http.X-Country-Code);
}

alternatively, i think i could also let the backend send a http header 
X-country-code and then add this to the hash instead?

sub vcl_hash {
     hash_data(beresp.http.X-Country-Code);
}

am I right on this?

greetings & thanks a lot for varnish!
the more i play with it the more i discover the power of it ;)

all the best
becki




More information about the varnish-misc mailing list