location /helloworld { content_by_lua ' ngx.header["Content-Length"] = 6 ngx.say("hello") '; }
Hello: 最近使用content_by_lua,发现输出结果不支持range处理。 location /helloworld { content_by_lua ' ngx.header["Content-Length"] = 6 ngx.say("hello") '; }代码如上,原因是r->allow_ranges为0。是不是有计划增加接口可以改变此参数?-- 么么哒best regards --
nginx 默认使用 http chunk 格式进行流式响应。所以这时候是不需要在头部声明 Content-Length 长度。content-length + body 的方式,适用范围有限,chunk 格式更为优秀。2016-01-25 17:06 GMT+08:00 bin liu <ops....@gmail.com>:Hello: 最近使用content_by_lua,发现输出结果不支持range处理。 location /helloworld { content_by_lua ' ngx.header["Content-Length"] = 6 ngx.say("hello") '; }代码如上,原因是r->allow_ranges为0。是不是有计划增加接口可以改变此参数?-- 么么哒best regards -- -- YuanSheng Wang---------------------------------------My Github: https://github.com/membphisOpenResty lover ^_^ --