How to get response headers from internal-requests?

Hi all,
Is there a way to get the response headers from internal-requests?

p.s. I am using ngx.location.capture(uri) for the internal requests.

Thanks in advance.


res.header holds all the response headers of the subrequest and it is a
normal Lua table. For multi-value response headers, the value is a Lua
(array) table that holds all the values in the order that they appear.
instance, if the subrequest response headers contain the following

Set-Cookie: a=3
Set-Cookie: foo=bar
Set-Cookie: baz=blah

Then res.header[“Set-Cookie”] will be evaluated to the table value
“foo=bar”, “baz=blah”}.

Posted at Nginx Forum: