Hi Sebastian,
As my C is a bit rusty and as I needed this working before the GeoIP
plugin worked, I created something on the basis:
sub vcl_recv {
...
if (req.url !~ "^/(en_gb|en_us)/*") {
set req.url = "/geoip.php?ip=" client.ip "&originalurl="
req.http.x-originalurl;
lookup;
}
..
}
This looks for urls which do not start en_gb or en_us and bounces them
through geoip.php which is a simple script (basically Maxmind's default
PHP script with a few minor tweaks) which then just returns a 302
redirect to example.com/(countrycode)/(original url).
Hope it helps.
Richard Chiswell
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
[email protected]
http://lists.varnish-cache.org/mailman/listinfo/varnish-misc
_______________________________________________
varnish-misc mailing list
[email protected]
http://lists.varnish-cache.org/mailman/listinfo/varnish-misc