Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将远程用户传递到lua文件_Lua_Ldap - Fatal编程技术网

将远程用户传递到lua文件

将远程用户传递到lua文件,lua,ldap,Lua,Ldap,下面是LDAP身份验证部分。配置nginx文件和lua脚本是和。在命令之后 sbin/nginx -p $PWD -c conf/nginx-ldap-auth.conf python backend-sample-app.py python nginx-ldap-auth-daemon.py 根据nginx-ldap-auth-daemon.py的日志,我已成功登录,即200 OK auth user admin。但我得到一个500内部服务器错误。在lua.log里我得到了 /usr/l

下面是LDAP身份验证部分。配置nginx文件和lua脚本是和。在命令之后

sbin/nginx -p $PWD -c conf/nginx-ldap-auth.conf
python backend-sample-app.py
python nginx-ldap-auth-daemon.py 
根据nginx-ldap-auth-daemon.py的日志,我已成功登录,即200 OK auth user admin。但我得到一个500内部服务器错误。在lua.log里我得到了

 /usr/local/openresty/nginx/authorize_es_ldap.lua: in function </usr/local/openresty/nginx/authorize_es_ldap.lua:1> while sending to client, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:8881", referrer: "http://localhost:8881/"
2016/09/29 23:35:27 [error] 23987#0: *10 lua entry thread aborted: runtime error: /usr/local/openresty/nginx/authorize_es_ldap.lua:50: attempt to concatenate global 'role' (a nil value)
/usr/local/openresty/nginx/authorize_es_ldap.lua:在发送到客户端时在函数中,客户端:127.0.0.1,服务器:,请求:“GET/HTTP/1.1”,主机:“localhost:8881”,引用方:http://localhost:8881/"
2016/09/29 23:35:27[错误]23987#0:*10 lua条目线程中止:运行时错误:/usr/local/openresty/nginx/authorize_es_ldap。lua:50:尝试连接全局“角色”(一个零值)
我认为问题是因为在教程中有一个空白,那就是如何将remote_用户变量传递给lua脚本。我试图在第204行添加self.send_头('LDAPUser',ctx['user']),在结束_头之前,在seld.send_响应(200)之后


您能帮助我吗?

您发布的lua脚本与原始教程中的脚本不同。请将
local user=ngx.var.remote\u user
替换为
local role=ngx.var.remote\u user
您发布的lua脚本与原始教程中的脚本不同。请将
local user=ngx.var.remote\u user
替换为
local role=ngx.var.remote\u user