On Tue, Mar 17, 2015 at 8:04 PM, Joe Williams <williams....@gmail.com> wrote:
> List,
>
> I am trying to figure out how to use the new lua API. After reading
> https://raw.githubusercontent.com/yuxans/haproxy/master/doc/lua-api/index.rst
> it still isn't clear to me how to get the client IP of a connection. Is
> information about the socket available inside lua? If so, any suggestions on
> how to access it? I am hoping to get the IP address from each HTTP request
> and do some processing on it.
>
> Thanks!
> -Joe

Joe,

It's not really clear in the documentation, but I put an example of an
HAProxy fetch called in a lua script:
http://blog.haproxy.com/2015/03/12/haproxy-1-6-dev1-and-lua/

Bascally, in your lua script, you can recover the client Ip address like this:
local clientip = txn.f:src()

Baptiste

  • lua api Joe Williams
    • Re: lua api Baptiste

Reply via email to