I have a custom TCP Server listening on port 5888(dummy port). The proxy server listens for incoming connections. When the proxy receives HTTP request for certain pages, it should relay it to the main server on port 80.For other page requests the proxy is required to send data to the main Server on port 8081.
The clients request for a .js file from the proxy. The proxy sends the same request to the main server on port 80. The main server is sending this message back along with Connection: Close.
HTTP/1.1 304 Not Modified
Date: Wed, 10 Oct 2012 10:45:49 GMT
Server: Apache/2.2.3 (Red Hat)
Connection: close
ETag: "748047-11f4f-4b8dc565b9100"
Which is causing the server and client sockets to disconnect (Detected Server Socket disconnect via read)
How to handle this situation ?
There is no problem here to ‘handle’. The server said to close the connection, and closed it itself. So close it, after you send that response back to the client, and close the connection to the client too. It’s not your job as a proxy server to fiddle around with this, not that you can.