There are two headers relate to Http keep alive,
Connection: Keep-Alive
Keep-Alive: timeout=5, max=1000
- Which side sends HTTP1.1 "Keep-Alive: param"?
- When client and server use HTTP1.1, will client send TCP keep alive probe?
- In order to use HTTP1.1 keep alive, must client set
Connection: Keep-AliveorKeep-Alive: param?
I have above qustions is because:
Recently I observed a problem using http client. After 2 hours since last time client sends request, once client sends request it would never hear response from server. In order to find reason, I did:
- having tcpdump runs on both client and server sides.
- client sends one request (and receives response)
- wait for 2 hours
- client sends another request (but does not receive any response) <-- this is the problem.
Between the two requests, pcaps on both sides show that no one sends FIN. And server does not receive the second request. I think something is messed up with HTTP1.1 keep alive transmission.
For Questions 1 and 3, see: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive
For question 2, see: HTTP Keep Alive and TCP keep alive
If you have e.g. NAT between the client and server, 2 hours can be too long for an idle connection to stay functional, but then again if neither side sees a fin, then someone is not handling things according to spec.