[SOLVED] Re: subrequest headers ignored

Konstantin Svist fry.kun на gmail.com
Вт Ноя 22 22:17:33 UTC 2011


https://github.com/chaoslawful/lua-nginx-module/issues/6


On 11/21/2011 06:24 PM, Konstantin Svist wrote:
> Подскажите пожалуйста, как такое лечится
> Я хочу вытащить хэдеры из lua subrequest. Вроде по документации они 
> должны сидеть в res.header, но там я только вижу ["Content-Type"] = 
> "application/octet-stream";
>
>
>
> location /foo {
>   content_by_lua 'local res = ngx.location.capture("/bar"); 
> ngx.print(res.header["Foo"])';
> }
> location /bar {
>   echo "baz";
>   add_header "Foo" "Bar";
> }
>
>
>
> $ curl -v 'http://localhost/foo'
> * About to connect() to localhost port 80 (#0)
> *   Trying 127.0.0.1... connected
> * Connected to localhost (127.0.0.1) port 80 (#0)
> > GET /foo HTTP/1.1
> > 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
> > Host: localhost
> > Accept: */*
> >
> < HTTP/1.1 200 OK
> < Server:
> < Date: Tue, 22 Nov 2011 02:18:18 GMT
> < Content-Type: application/octet-stream
> < Transfer-Encoding: chunked
> < Connection: keep-alive
> <
> * Connection #0 to host localhost left intact
> * Closing connection #0
> nil#
>
>
>
> $ curl -v 'http://localhost/bar'
> * About to connect() to localhost port 80 (#0)
> *   Trying 127.0.0.1... connected
> * Connected to localhost (127.0.0.1) port 80 (#0)
> > GET /bar HTTP/1.1
> > 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
> > Host: localhost
> > Accept: */*
> >
> < HTTP/1.1 200 OK
> < Server:
> < Date: Tue, 22 Nov 2011 02:17:38 GMT
> < Content-Type: application/octet-stream
> < Transfer-Encoding: chunked
> < Connection: keep-alive
> < Foo: Bar
> <
> baz
> * Connection #0 to host localhost left intact
> * Closing connection #0
>
>



Подробная информация о списке рассылки nginx-ru