transfer-encoding is not accessible from header-filter-by-lua block

60 views
Skip to first unread message

Hadi Abbasi

unread,
Nov 10, 2018, 9:05:50 AM11/10/18
to openresty-en
Hi...
I'm trying to make a proxy server using openresty and my Simplified code is:
server {
       location
/ {
           
...
     
}


     location
@proxyPass {
         
..
         
..
         header_filter_by_lua_block  
{
           ngx
.print("transfer-encoding: " .. (ngx.resp.get_headers()["Transfer-Encoding"]  or  "Empty"))  -- Output : transfer-encoding: Empty
       
}
   
}
}


so I don't know why it's empty and how can I access transfer-encoding from header filter by lua!
please help me because it's important challenge for me..
thanks a lot..
Best,

Hadi Abbasi

unread,
Nov 10, 2018, 9:12:21 AM11/10/18
to openresty-en
my browser shows that some responses have transfer-encoding attribute but I can't trace them from header_filter_by_lua_block for unknown reason!!!

Hadi Abbasi

unread,
Nov 10, 2018, 9:19:26 AM11/10/18
to openresty-en
also I have tested ngx.header["Transfer-Encoding"] but the result is as before!
Message has been deleted

tokers

unread,
Nov 14, 2018, 9:49:21 PM11/14/18
to openresty-en
Hello!

The Transfer-Encoding is really a critical response header, it will be set in the ngx_http_header_filter_module.c:ngx_http_header_filter  which is the last header filter module, so ngx_lua's header filter runs prior to this module.

Hadi Abbasi

unread,
Dec 11, 2018, 8:28:27 AM12/11/18
to openresty-en
thanks a lot tokers...
Reply all
Reply to author
Forward
0 new messages