Geolocation without compiling Varnish from source

John spam at onlineconcepts.com
Tue Mar 26 19:00:12 CET 2013


I would like to geolocate our website visitors by country. Varnish can
send the ISO country code to our backend, which will then serve the users
content specific to their region of the world.

VERSION INFO
We're running Red Hat Enterprise Linux 6.2 (RHEL).

"varnishd -V" produces:

varnishd (varnish-3.0.2 revision 55e70a4)

STEPS TAKEN THUS FAR
I'm attempting to follow the solution described here.
https://github.com/guybedford/varnish-geoip

1) Installed the MaxMind Geolocation API for C

2) Installed the MaxMind Binary GeoIP Country DB

3) Downloaded GeoIP Plugin for Varnish per
https://www.varnish-cache.org/trac/wiki/GeoipUsingInlineC

I don't think #3 is the solution we ultimately want to use, but running
"make test" produced the following output, indicating that the MaxMind
Geolocation API is probably (?) installed correctly.

Testing IPs:
195.110.128.11 => IT (OK)
157.166.224.25 => US (OK)
212.58.224.138 => GB (OK)
80.91.37.210 => NO (OK)
192.168.0.1 => Unknown (OK)
(null) => Unknown (OK)

AVOIDING COMPILATION
I'm more of a developer than a Linux sysadmin. I would like to continue to
maintain Varnish versions using standard yum commands, rather than
compiling from source.

I followed these instructions https://github.com/guybedford/varnish-geoip
and then ran this command.

varnishd -f /etc/varnish/default.vcl -p 'cc_command=exec cc -fpic -shared
-Wl,-x -L/usr/local/lib -lGeoIP -o %o %s'

This produces an error.

----------------------
Message from dlopen:
Compiled VCL program failed to load:
  ./vcl.8BAo5_pH.so: undefined symbol: vcl_geoip_set_header
Running dlopen failed, exit 1
VCL compilation failed
----------------------

I found the links below useful, but none of them fixed my problem. The one
solution I have not tried is creating a VMOD because it seems to require
recompiling Varnish.

https://github.com/guybedford/varnish-geoip
https://github.com/cosimo/varnish-geoip/
http://drcarter.info/2010/07/another-way-to-link-varnish-and-maxmind-geoip/
https://www.varnish-cache.org/trac/wiki/GeoipUsingInlineC
http://www.mursalat.net/tag/varnish3
https://plus.google.com/112740765000604900893/posts/DnomVJRMG4E

Thanks for any advice,
John



More information about the varnish-misc mailing list