当前位置: > Linux服务器 > nginx >

Nginx Lua Proxy

时间:2016-12-18 10:07来源:linux.it.net.cn 作者:IT
location / {
    set $bindip '';
    content_by_lua_file '/usr/local/nginx/lua/proxy.lua';
}
location /proxy {
    proxy_pass       "http://$host$request_uri";
    proxy_bind       $bindip;
}
local action = ngx.var.request_method
if action == "POST" then
    method = ngx.HTTP_POST
else
    method = ngx.HTTP_GET
end
res = ngx.location.capture(
    '/proxy', { method = method, always_forward_body = true, copy_all_vars = true }
    )
ngx.print(res.body)
ngx.print(res.status)



(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容