{"issue":{"created_at":"2011-11-22T22:57:41Z","state":"closed","updated_at":"2011-11-28T09:23:32Z","user":{"gravatar_id":"60af9b9477a6f6c7fa1fb397a9a24f0c","id":1214224,"url":"https://api.github.com/users/Fry-kun","avatar_url":"https://secure.gravatar.com/avatar/60af9b9477a6f6c7fa1fb397a9a24f0c?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"Fry-kun"},"comments":2,"body":"lua-nginx 5fcb1a7b8bc61f5ee244593b2b38ee90d058ed23\r\nnginx 1.1.8\r\n\r\nI'm trying to have nginx add a custom return header, but lua code doesn't see it. If it matters, my original code sets it in a redis2 internal location, but for simplicity the example below uses echo\r\n\r\n\r\nnginx config:\r\n\r\nlocation /foo {\r\n  content_by_lua 'local u=require(\"utils\");local res=ngx.location.capture(\"/bar\"); ngx.print(u.pformat(res))';\r\n}\r\nlocation /bar {\r\n  echo \"baz\";\r\n  add_header \"Foo\" \"Bar\";\r\n}\r\n\r\n\r\nResults:\r\n\r\n$ curl -v 'http://localhost/bar'\r\n* About to connect() to localhost port 80 (#0)\r\n*   Trying 127.0.0.1... connected\r\n* Connected to localhost (127.0.0.1) port 80 (#0)\r\n> GET /bar HTTP/1.1\r\n> User-Agent: curl/7.21.3-DEV (x86_64-unknown-linux-gnu) libcurl/7.21.3-DEV OpenSSL/1.0.0 zlib/1.2.5 libssh2/1.2.4\r\n> Host: localhost\r\n> Accept: */*\r\n> \r\n< HTTP/1.1 200 OK\r\n< Server: \r\n< Date: Tue, 22 Nov 2011 22:55:08 GMT\r\n< Content-Type: application/octet-stream\r\n< Transfer-Encoding: chunked\r\n< Connection: keep-alive\r\n< Foo: Bar\r\n< \r\nbaz\r\n* Connection #0 to host localhost left intact\r\n* Closing connection #0\r\n\r\n\r\n$ curl -v 'http://localhost/foo'\r\n* About to connect() to localhost port 80 (#0)\r\n*   Trying 127.0.0.1... connected\r\n* Connected to localhost (127.0.0.1) port 80 (#0)\r\n> GET /foo HTTP/1.1\r\n> User-Agent: curl/7.21.3-DEV (x86_64-unknown-linux-gnu) libcurl/7.21.3-DEV OpenSSL/1.0.0 zlib/1.2.5 libssh2/1.2.4\r\n> Host: localhost\r\n> Accept: */*\r\n> \r\n< HTTP/1.1 200 OK\r\n< Server: \r\n< Date: Tue, 22 Nov 2011 22:55:37 GMT\r\n< Content-Type: application/octet-stream\r\n< Transfer-Encoding: chunked\r\n< Connection: keep-alive\r\n< \r\n__unnamed__ = {\r\n   [\"status\"] = 200;\r\n   [\"body\"] = \"baz\\\r\n\";\r\n   [\"header\"] = {\r\n      [\"Content-Type\"] = \"application/octet-stream\";\r\n   };\r\n};\r\n* Connection #0 to host localhost left intact\r\n* Closing connection #0\r\n","assignee":null,"id":2324168,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"labels":[],"number":68,"title":"Headers not returned from subrequest","closed_at":"2011-11-28T09:23:32Z","html_url":"https://github.com/chaoslawful/lua-nginx-module/issues/68","milestone":null,"url":"https://api.github.com/repos/chaoslawful/lua-nginx-module/issues/68"},"action":"created","comment":{"created_at":"2011-11-28T09:23:32Z","updated_at":"2011-11-28T09:23:32Z","user":{"gravatar_id":"37f3ea777f96500b332a1a89d6027897","id":56241,"url":"https://api.github.com/users/agentzh","avatar_url":"https://secure.gravatar.com/avatar/37f3ea777f96500b332a1a89d6027897?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"agentzh"},"body":"Consider it resolved.","id":2894655,"url":"https://api.github.com/repos/chaoslawful/lua-nginx-module/issues/comments/2894655"}}