nginx - openresty does not output content-length header
巴扎黑
巴扎黑 2017-05-16 17:09:02
0
1
684

Openresty defaults to chunked_transfer_encoding on, which means chunked encoding is used. At this time, content-length is useless.
Then our client has a demand for this field, and our business logic is relatively simple, so I turned off chunked. At this time, it becomes a short connection, but the content-length field will not be automatically generated. If I have to manually calculate the returned content length before each return, it will be more laborious, and I am dynamically generating the content.

巴扎黑
巴扎黑

reply all(1)
迷茫

This problem has nothing to do with whether it is openresty, but when outputting dynamic content, the web server will not know the size of the content you want to output at all. If it is a static resource, the web server will be able to obtain the resource when outputting these static resources. size, you can also specify the content-length response header. Therefore, if dynamic content needs to support the content-length response header, you can only add it yourself.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!