nginx.conf中部分配置如下:
location /father
{
content_by_lua '
local res = ngx.location.capture("/son")
ngx.say(res.body)
';
}
location /son
{
access_by_lua '
ngx.req.set_header("host","testlua")
';
content_by_lua '
ngx.say(ngx.var.http_host)
';
}
这时候:
请求 curl http://localhost/father ,输出为 localhost
请求 curl http://localhost/son ,输出为 testlua
问题是: 如何能够达到 请求 curl http://localhost/father时,输出testlua的目的?