I'm adding several patches for use with mod_geoip (http://trac.lighttpd.net/trac/wiki/Docs:ModGeoip) which allow:
* A 'geoip.default_country_code' to be set when no matching country could be found.
* A 'geoip.force_lowercase' to be set to force all returned country codes in lowercase.
* Environment variables to be picked up and used in mod_redirect targets.
Example of combined usage:
geoip.db-filename = "/usr/share/GeoIP/GeoIP.dat"
geoip.memory-cache = "enable"
$HTTP["host"] =~ "^(www\.example\.com)(:[0-9]+)?$" {
geoip.default_country_code = "us"
geoip.force_lowercase = "enable"
url.redirect = (
"^/$" => "http://%1%2/#GEOIP_COUNTRY_CODE#/",
)
}
This allows us to do in-server redirects based on GeoIP country codes. I know the patches aren't ideal (changes only done for country codes for example), but they might be useful to someone nevertheless. It beats using a PHP script, but some LUA might also do the trick. These patches are quite old, but have been in large scale production for over a year now without problems.