How To Pass arguments to LUA from HAProxy config. I am trying to pass certificate DN information for client and CA, but getting error in haproxy config check.
HAProxy LUA config
global
lua-load /usr/sbin/lua-choose-backend.lua
frontend http-in
mode http
log-format %ci:%cp\ [%t]\ %ft\ %b/%s\ %Tq/%Tw/%Tc/%Tr/%Tt\ %ST\ %B\ %CC\ %CS\ %tsc\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ %hr\ %hs\ {%[ssl_c_verify],%{+Q}[ssl_c_s_dn],%{+Q}[ssl_c_i_dn]}\ %{+Q}r
bind *:443 ssl crt /etc/haproxy/server.pem ca-file /etc/haproxy/ca.crt verify required
use_backend %[lua.choose_backend([ssl_c_s_dn], [ssl_c_i_dn])]
#use_backend app
default_backend app
reqadd X-Forwarded-Proto:\ https if { ssl_fc }
option forwardfor
.
/usr/sbin/lua-choose-backend.lua
function choose_backend(txn, arg1, arg2)
core.log(core.info, "Hello World")
core.log(core.info, arg1)
core.log(core.info, arg2)
return "app"
end
core.register_fetches("choose_backend", choose_backend)
.
$ haproxy -c -f /etc/haproxy/haproxy.cfg
[WARNING] 133/050028 (6381) : parsing [/etc/haproxy/haproxy.cfg:88] : 'acl' : sample fetch <lua.choose_backend([ssl_c_s_dn> failed with : missing closing ')' after arguments to fetch keyword 'lua.choose_backend'
[ALERT] 133/050028 (6381) : Proxy 'http-in': unable to find required use_backend: '%[lua.choose_backend([ssl_c_s_dn],'.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
i have followed this link http://www.techietown.info/2016/10/haproxy-with-lua-support/
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.