old-openresty icon indicating copy to clipboard operation
old-openresty copied to clipboard

echo_subrequest adds http headers

Open ovh opened this issue 13 years ago • 2 comments

When changing:

echo_foreach_split ',' $filelist; echo_subrequest_async GET '/getFile' -q 'file=$echo_it' ; echo_end;

to

echo_foreach_split ',' $filelist; echo_subrequest GET '/getFile' -q 'file=$echo_it' ; echo_end;

the body is modified, and I see some http headers added:

@HTTP/1.1 200 OK^M Server: ngx_openresty^M Date: Wed, 02 May 2012 10:25:06 GMT^M Content-Type: text/plain^M Transfer-Encoding: chunked^M Connection: close^M

ovh avatar May 02 '12 10:05 ovh

Yes, the chunked encoding is enforced when subrequests are used this way. Because ngx_echo cannot know the total response body size beforehand. Also, you should adjust the Content-Type and other headers accordingly because subrequests' response headers will not be forwarded to the parent request.

BTW, please do not report issues regarding the ngx_openresty project (https://github.com/agentzh/ngx_openresty ) to the old Perl implementation of the OpenResty server. Report to the ngx_openresty github project instead. Thank you!

agentzh avatar May 02 '12 13:05 agentzh

On 02/mai - 06:15, agentzh (章亦春) wrote:

Yes, the chunked encoding is enforced when subrequests are used this way. Because ngx_echo cannot know the total response body size beforehand. Also, you should adjust the Content-Type and other headers accordingly because subrequests' response headers will not be forwarded to the parent request.

BTW, please do not report issues regarding the ngx_openresty project (https://github.com/agentzh/ngx_openresty ) to the old Perl implementation of the OpenResty server. Report to the ngx_openresty github project instead. Thank you! sorry about that, I will :)


Reply to this email directly or view it on GitHub: https://github.com/agentzh/openresty/issues/1#issuecomment-5461048

ovh avatar May 02 '12 13:05 ovh