Hi!

We have been using haproxy for many years and recently I found that it is possible to use Lua to dynamically configure it. That is great!

I would like to create a service which balances the HTTP requests on many servers without passing through the traffic on the proxy: actually it would redirect (HTTP 3xx) to the target server. As server status is available in haproxy (core.proxies[backend].servers), only the balance algorithm is needed to select an alive server for redirection. I could not find any solution to get the server id or name after balance algorithm (eg. balance uri) runs without sending the request to the selected server.

That is why I thought about to implement the balancing in Lua but converters like crc32 or djb2 are not available in init (or I have not found how to access them). I would like to precalculate server hashes in init (for consistent hash) and not in runtime.

Is there a way to get the backend id or name without proxying the request?
Are converter functions available in init phase?

Thanks in advance.

BR, Gabor



Reply via email to