Re: Lua LDAP控制后端没有认证服务的页面的问题请教

62 views
Skip to first unread message
Message has been deleted

relvrui

unread,
Apr 13, 2019, 10:19:40 PM4/13/19
to openresty


在 2019年4月14日星期日 UTC+8上午10:17:29,relvrui写道:
大家好!我在使用Kibana过程中,由于页面访问是没有认证机制的,直接是类似  http://192.168.1.2:5601
于是想用弄了个简单的form表单,openresty+lua ldap加一层验证,验证通过再反向代理到后端服务,后端服务是http://localhost:5601
部分配置如下:
     location = / {
               set $kibana '';
               access_by_lua '
                 local args = ngx.req.get_uri_args()
                 local ldapuser = args["username"]
                 local ldappass = args["password"]

                 lualdap = require "lualdap"
                 ldap_auth, err = lualdap.open_simple("ldap:389",ldapuser.."@com.cn",ldappass)
                 if err ~= nil then
                   ngx.redirect("/error.html")
                   ldap_auth:close()
                   ngx.exit(200)
                 end
                 ngx.var.kibana = "http://192.168.1.2:5601/app/kibana"
              ';
               proxy_pass $kibana;
              }
          }

但是实际在使用过程中却在我的代理机器上取js资源

N6E~7D9N~H8UA2L0)D1JB47.png

有没有弄过类似需求的朋友,麻烦给下指导。谢谢了!

N6E~7D9N~H8UA2L0)D1JB47.png
Reply all
Reply to author
Forward
0 new messages