Closed shubenkov closed 7 years ago
@shubenkov The error message is clear that you try to set the cookie (which is a special response header) after your whole response header is already sent. You would need a "time machine" to add a response header when the whole header is sent out to the client.
Be aware that ngx_lua uses non-buffered output mode by default, which means if you try to send some response body data (via ngx.print
or ngx.say
, for example), the response header is automatically sent out first at that point.
When I try to set cookie:
2016/07/11 10:44:43 [error] 19243#0: *272 attempt to set ngx.header.HEADER after sending out response headers, client: 5.61.237.205, server: localhost, request: