Guys I know most of you will say its a bad design and its not possible, but I want to explore the power of HTTP Status codes
I have a client and a server. Theres a loadbalancer in between. For some reason its timeout cannot be increased . I don't want to modify the client.
I am doing a heavy duty processing on the server that exceeds the loadbalancer's timeout.
I was streaming response to the client. After my heavy job is finished i send the final response to client.
Is it possible to somehow alert the client to discard any streamed data sent before the response. Can i send just the response code again. (Any hack?)
Since status codes are sent on the first line of a response, followed by headers, it should be obvious that you can only send a code once.
The subject of handling long running processes within the context of a HTTP server has been covered many times - the consensus is that you should farm long running processes out to a separate thread and provide a mechanism separate request to get the results.