0

As the default behavior of HTTP1.0 is non-persistent and HTTP1.1 is persistent but I have to make HTTP1.1 non-persistent only in case of logout operation by handling at server side only disregard of whatever is coming in logout request and it's headers.

The connection is closing in case of error scenarios but I have to close in case of success (200) as well.

I have tried setting up response header by doing (Java) response.setHeader("Connection","close"). This results in Connection: close, keep-alive is the response headers.

I tried to invalidate the session using session.invalidate() , this might have been solved the purpose (not sure) but it response header still i see, Connection: keep-alive.

Please suggest how can I achieve this?

  • I haven't done web development in a while but if I recall this correctly the Servlet API does not expose this type of capability, this is highly server dependent. I suggest you search documentation on how to setup the server you are using. What is the server you are using, by the way? By the way, I would also look at setting up "idle timeout" numbers for your server, that might suffice. – Marcio Lucca Jun 25 '20 at 04:46
  • I am using Tomcat and my server level configurations are: – Nisha Mittal Jun 26 '20 at 03:28
  • I know this is not the answer you are looking for but the easiest way to deal with this would be to pick a number for connectionTimeout that suits your needs. Right now you are using 20 seconds, that feels about right to me. If you have control over the HTTP client (assuming you're not using a browser), you could also try to set this up there. – Marcio Lucca Jun 27 '20 at 03:21

0 Answers0