I have a java application deployed on Cloud Foundry, I implemented one HttpRequestHandler in this application, the code is as below:
@Override
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setHeader("Content-Type", "text/plain");
// avoid the gzip for log
response.setHeader("Content-Encoding", "");
// disable nginx to buffer the data.
response.setHeader("X-Accel-Buffering", "no");
// add it as one subscriber
_logService.addSubscriber(response.getWriter());
}
In method of _logService.addSubscriber(PrintWriter logWriter), will get message and flush message as below:
logWriter.write(_message);
logWriter_writer.flush();
This HttpRequestHandler works well before CF V252, but from version 252, didn't work, there is the following error when invoke this HttpRequestHandler from browser:
This page isn’t working
hostxx.xxx unexpectedly closed the connection.
ERR_INCOMPLETE_CHUNKED_ENCODING