Repository navigation
Require json #17
Description
Hi all,
My environment : Centos 8 + haproxy-2.2.10 + lua-5.3.5 install from source following instruction : https://kifarunix.com/install-haproxy-on-rocky-linux-8/
I followed instruction at : https://www.authelia.com/docs/deployment/supported-proxies/haproxy.html
global
# Path to haproxy-lua-http, below example assumes /usr/local/etc/haproxy/haproxy-lua-http/http.lua
lua-prepend-path /usr/local/etc/haproxy/http.lua
# Path to haproxy-auth-request
lua-load /usr/local/etc/haproxy/auth-request.lua
log stdout format raw local0 debug
When I check haproxy cfg I get errors:
haproxy -c -f haproxy.cfg
[NOTICE] (26946) : haproxy version is 2.4.2-553dee3
[NOTICE] (26946) : path to executable is /usr/local/sbin/haproxy
[ALERT] (26946) : parsing [haproxy.cfg:5] : Lua runtime error: error loading module 'json' from file '/usr/local/etc/haproxy/http.lua':
/usr/local/etc/haproxy/http.lua:673: too many C levels (limit is 200) in function at line 619 near 'v'
[ALERT] (26946) : parsing [haproxy.cfg:51]: 'http-request' expects 'wait-for-handshake', 'use-service', 'send-spoe-group', 'sc-inc-gpc0()', 'sc-inc-gpc1()', 'sc-set-gpt0()', 'do-resolve()', 'cache-use', 'add-acl()', 'add-header', 'allow', 'auth', 'capture', 'del-acl()', 'del-header', 'del-map()', 'deny', 'disable-l7-retry', 'early-hint', 'normalize-uri', 'redirect', 'reject', 'replace-header', 'replace-path', 'replace-pathq', 'replace-uri', 'replace-value', 'return', 'set-header', 'set-log-level', 'set-map()', 'set-method', 'set-mark', 'set-nice', 'set-path', 'set-pathq', 'set-query', 'set-tos', 'set-uri', 'strict-mode', 'tarpit', 'track-sc()', 'set-timeout', 'wait-for-body', 'set-var()', 'unset-var(*)', 'set-priority-class', 'set-priority-offset', 'silent-drop', 'set-src', 'set-src-port', 'set-dst', 'set-dst-port', but got 'lua.auth-request'.
[ALERT] (26946) : Error(s) found in configuration file : haproxy.cfg
How can I fix it ? Please give me some advice , thank you very much.
Activity
rocklee44 commentedon May 25, 2022
My server Centos 8(minimal) has already lua-5.3.4 installed , and I also installed lua-json
I fixed it by editing /usr/local/etc/haproxy/http.lua
It works fine now.
schklom commentedon Apr 23, 2023
I don't remember where I read this, but I loaded https://github.com/rxi/json.lua with
to work for Authelia, and it works.
james-d-elliott commentedon Apr 12, 2024
Pretty sure this is a dist issue with the various operating systems. Here's my test script I used to help diagnose it:
Running that reveals the if the issue is exists because of the install or if it's something else (if it prints an error it's due to the versions installed of lua and lua-json which are conflicting, if it runs it's something else, if it runs after suggested fixes it shows it should now work), also reveals the search path lua is using (snippet 2). If you then use a tool like mlocate to find the locations json.lua exists you'll note that it may not exist for the version of lua you have installed. In which case you have to install a compatible lua version or use the workaround by @schklom.
Some example outputs for Ubuntu 22.04:
# lua -v Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio# locate json.lua /usr/share/lua/5.1/json.lua /usr/share/lua/5.2/json.lua /usr/share/lua/5.3/json.luaFix for Ubuntu 22.04:
apt remove lua5.4 && apt install lua5.3Seems in this specific fix it doesn't fix it for haproxy, it still has issues loading the module which is very odd.
piengeng commentedon Dec 26, 2024
was on ubuntu 24.04 with
lua-jsonpackage, have to workaround with below, since 5.2/5.3 all point back to 5.1