我试图让它在我的nginx.conf文件中运行lua代码,我试图通过proxy_pass连接到另一个Web应用程序,并根据HTTP结果呈现一些资源。 这是我的代码
location /_auth {
proxy_set_header Accept-Encoding "";
proxy_pass http://127.0.0.1:8080/Welvi-rest;
}
location /server/ {
content_by_lua "
local res = ngx.location.capture('/_auth');
ngx.print(res.status);
if res.status ~= ngx.HTTP_OK then
ngx.exit(ngx.HTTP_FORBIDDEN)
end
";
}
但我不知道为什么永远不会调用8080中的Web应用程序服务器。
我读过与问题相关的内容,因为我们需要在lua中添加标题,但我找不到解决此问题的方法