View previous topic :: View next topic |
Author |
Message |
hydrapolic Tux's lil' helper

Joined: 07 Feb 2008 Posts: 126
|
Posted: Tue Dec 10, 2013 2:34 pm Post subject: varnish + libvmod-geoip |
|
|
varnish (https://www.varnish-cache.org/)
Varnish is a web application accelerator. You install it in front of your web application and it will speed it up significantly.
libvmod-geoip (https://github.com/lampeh/libvmod-geoip)
This Varnish module exports functions to look up GeoIP country codes in VCL.
Sometimes, you need to serve different content to people from different countries. Varnish has no built-in functionality to add the country header when sending requests to the backends. Luckily, we can use some of the vmods that link varnish with geoip.
1) get libvmod-geoip ebuild
https://github.com/hydrapolic/gentoo/tree/master/www-servers/libvmod-geoip
2) emerge libvmod-geoip
3) edit /etc/varnish/default.vcl
import geoip;
backend default {
.host = "backend.example.com";
.port = "80";
}
sub vcl_recv {
set req.http.X-Country-Code = geoip.client_country_code();
}
From now on, the backend will have the header X-Country-Code set to the country from which the request came from. |
|
Back to top |
|
 |
vguardiola n00b


Joined: 15 Jun 2004 Posts: 9
|
Posted: Tue Jul 08, 2014 1:21 pm Post subject: |
|
|
HI, I just finish complie the lib but when I tty to restart varnisd and I get this error:
Quote: | varnishd | * varnishd has detected an error in your setup:
varnishd |Message from VCC-compiler:
varnishd |Could not load VMOD geoip
varnishd | File name: /usr/lib64/varnish/vmods/libvmod_geoip.so
varnishd | dlerror:: /usr/lib64/varnish/vmods/libvmod_geoip.so: undefined symbol: W_Dup
varnishd |('input' Line 2 Pos
varnishd |import geoip;
varnishd |-------#####-
|
some Idea? _________________ ----
Victor Guardiola
http://www.masquesoft.net
http://www.masquelinux.net
http://www.masquejuegos.net
http://www.masquewireless.net
http://www.rubiwireless.net |
|
Back to top |
|
 |
hydrapolic Tux's lil' helper

Joined: 07 Feb 2008 Posts: 126
|
Posted: Thu Jul 10, 2014 12:38 pm Post subject: |
|
|
The ebuild is made for Varnish 3.0.5, is that the version of Varnish which you have installed? (VARNISH_VERSION="3.0.5") |
|
Back to top |
|
 |
|