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)
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) |