Hi Willy,

This trick is great but I need to do some more complicate to encode doubles to 
string, is there a way that I can implement geohash_encode?

http-request add-header x-foo %[geohash_encode(header1,header2)]

Geohash string defines a square on the globe and with a few squares you can 
define a region like a city or a state, so is easier to match these few strings 
and define what is the closest server to the client's location, because 
latitude and longitude inside a square has the same string prefix.

Tks in advance,
Marcelo Milhomem

Enviada do meu iPhone

> Em 06/09/2014, às 04:50, Willy Tarreau <[email protected]> escreveu:
> 
>> On Sat, Sep 06, 2014 at 12:20:48AM -0300, Marcelo Milhomem wrote:
>> Today we can balance requests by user's location using a string geohash
>> header and an ACL with hdr_beg(). We now have some request that only have
>> the Latitude and Longitude from GPS but is too hard to match against it, we
>> know that these numbers can be converted to geohash like this library do
>> https://github.com/simplegeo/libgeohash/blob/master/geohash.c
>> Is there a way that we can use two headers values(double type) as
>> parameters to a geohash function and match the result(string type) using
>> hdr_beg()?
> 
> I don't know how this thing works, but there's a trick to combine multiple
> headers into one. You can use the add-header action of the http-request
> ruleset, and build a new header from the two other ones. Example :
> 
>    http-request add-header x-foo %[hdr(header1)]%[hdr(header2)]
> 
> Then you can balance on hdr(x-foo). I don't know if that can help you here.
> 
> Willy
> 

Reply via email to