mirror of
https://github.com/ohwgiles/laminar.git
synced 2024-10-27 20:34:20 +00:00
log endpoint: hint to reverse-proxy not to buffer
As discussed in #88, nginx will buffer the chunked transfer-encoding unless the proxy_buffering directive is disabled, or the X-Accel-Buffering header is set to no. Do the latter to reduce configuration burden on frontend reverse-proxy setups.
This commit is contained in:
parent
303fe7c6ae
commit
210787a352
@ -415,6 +415,8 @@ private:
|
|||||||
if(laminar.handleLogRequest(name, num, output, complete)) {
|
if(laminar.handleLogRequest(name, num, output, complete)) {
|
||||||
responseHeaders.set(kj::HttpHeaderId::CONTENT_TYPE, "text/plain; charset=utf-8");
|
responseHeaders.set(kj::HttpHeaderId::CONTENT_TYPE, "text/plain; charset=utf-8");
|
||||||
responseHeaders.add("Content-Transfer-Encoding", "binary");
|
responseHeaders.add("Content-Transfer-Encoding", "binary");
|
||||||
|
// Disables nginx reverse-proxy's buffering. Necessary for dynamic log output.
|
||||||
|
responseHeaders.add("X-Accel-Buffering", "no");
|
||||||
auto stream = response.send(200, "OK", responseHeaders, nullptr);
|
auto stream = response.send(200, "OK", responseHeaders, nullptr);
|
||||||
laminar.registerClient(cc.get());
|
laminar.registerClient(cc.get());
|
||||||
return stream->write(output.data(), output.size()).then([=,s=stream.get(),c=cc.get()]{
|
return stream->write(output.data(), output.size()).then([=,s=stream.get(),c=cc.get()]{
|
||||||
|
Loading…
Reference in New Issue
Block a user