nginx subrequest

#main request & subrequests
>main request:HTTP requests initiated from the client side
>A subrequest is an abstract invocation for decomposing the task of the main request into smaller “internal requests” that can be served independently by multiple different location blocks, either in series or in parallel
>the communication of location blocks via subrequests is limited within the same server block (i.e., the same virtual server configuration)
#Variables with the same name between a parent request and a subrequest will generally not interfere with each other
location /main {
set var main;  echo_location /foo; echo_location /bar;  echo "main: var”;

location /foo {
set var foo; echo "foo: var”;

location /bar {
set var bar; echo "bar: var”;

 curl 'http://localhost:8080/main' foo: foo bar: bar</div> <div>main: main</div> <div><b> </b></div> <div><b>Exception: </b><b>Shared Variable Containers among Requests </b></div> <div><b> </b></div> <div>location /main { set var main;
auth_request /sub;
echo “main: var"; }  location /sub { set var sub;
echo “sub: var";</div> <div>}</div> <div>================================</div> <div> curl ‘http://localhost:8080/main’
main: sub
#build-in variables in subrequest
>sensitive to subrequest
args</div> <div>uri
echo_request_method</div> <div>>main request onlyrequest_method