Hello!
On Wed, Jan 8, 2014 at 2:55 AM, Ajay k wrote:
> Which is used as part of the ngx.location.capture(subrequest) calls to the
> /xauth , Does the subrequest calls adhere the keepalive settings ?
>
Yes, it should. I've turned your example into a self-contained example
that can run everywhere:
upstream backend {
server 127.0.0.1:8080;
keepalive 20;
}
server {
listen 8080;
keepalive_timeout 120s;
location = /xauth {
internal;
resolver 8.8.8.8;
proxy_pass http://backend/fake;
proxy_method GET;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass_request_body off;
proxy_pass_request_headers off;
}
location = /fake {
return 200 "fake response";
}
location = /t {
content_by_lua '
local res = ngx.location.capture("/xauth")
ngx.status = res.status
ngx.say(res.body)
';
}
}
And then query the /t interface with curl:
$ curl localhost:8080/t
fake response
And then check the established connections to the port 8080:
$ netstat -nt|grep 8080|grep ESTABLISHED
tcp 0 0 127.0.0.1:8080 127.0.0.1:47795
ESTABLISHED
tcp 0 0 127.0.0.1:47795 127.0.0.1:8080
ESTABLISHED
We can see that there is an established connection which should be the
idle connection in the pool.
Basically you can always *test* such things yourself with a minimal
example locally ;)
Best regards,
-agentzh