location = /test {
ngx.say("test...")
ngx.exit(500)
}
报错为:
attempt to set status 500 via ngx.exit after sending out the response status 200, client: ::1, server: localhost, request: "GET /test HTTP/2.0", host: "localhost"
attempt to set status 500 via ngx.exit after sending out the response status 200, client: ::1, server: localhost, request: "GET /test HTTP/1.1", host: "localhost"
根据报错来说,这是因为ngx.say提前将响应送出导致的。而且在(HTTP/1.1的)响应头中的确能看到TE: chunked
那么这个行为是by design的吗?有没有什么办法能改变这个行为呢?