On Thu, 2 Jun 2016 11:17:09 -0400 Louis Munro <[email protected]> wrote:
> Hi Thierry, > -- > Louis Munro > [email protected] :: www.inverse.ca > +1.514.447.4918 x125 :: +1 (866) 353-6153 x125 > Inverse inc. :: Leaders behind SOGo (www.sogo.nu) and PacketFence > (www.packetfence.org) > > > On Jun 2, 2016, at 7:17 , Thierry FOURNIER <[email protected]> > > wrote: > > > > Hi, you can do that you describre. First, you can read the general > > introduction: > > > > http://www.arpalert.org/haproxy-lua.html > > > > For using redis, you can deal with cosocket, the API documentation > > provides an example with one redis library: > > > > > > http://www.arpalert.org/src/haproxy-lua-api/1.6/index.html#external-lua-libraries > > > > > I have actually already done that (although I may have missed some of the > finer points of the documentation). > > I’ve got HAProxy/ Lua / Redis working at the moment and returning a redirect > based on a key in Redis. > > > > > You can use an action (who can yield), store the result in a variable, > > and use this variable for decisions. > > > > http://www.arpalert.org/src/haproxy-lua-api/1.6/index.html#TXN.set_var > > http://cbonte.github.io/haproxy-dconv/configuration-1.6.html#7.3.2-var > > > > core.register_action("select", { "http-req" }, function(txn) > > -- deal with redis > > -- ... > > -- store the result: > > txn:set_var("req.action", "backend1") > > end) > > > > In the haproxy configuration: > > > > > > Don't hesitate to share your work (if it is possible). I try to list > > article about haproxy and lua. > > > Thank you very much. > I will definitely write it up if I get it to do what I want. > > The ultimate goal is to integrate this into PacketFence, an open source NAC > solution to which I contribute (https://github.com/inverse-inc/packetfence > <https://github.com/inverse-inc/packetfence>). > So the code would end up on github for anyone to reuse. > > I think you just gave me what I needed, which is the reassurance that I am > not wasting my time trying to do the impossible. Ok, it is great. BR, Thierry > > Best regards, > -- > Louis Munro > [email protected] :: www.inverse.ca > +1.514.447.4918 x125 :: +1 (866) 353-6153 x125 > Inverse inc. :: Leaders behind SOGo (www.sogo.nu) and PacketFence > (www.packetfence.org) > --

