I have a set of clients that aren't including an http keep-alive header in their requests to my server. If I use something like Varnish to filter the incoming requests and add the keep-alive header to the request before it reaches my web server, can I force the client to use keep-alive?
Configure Server to Initiate Http Keep-Alive
http-headerskeepalivevarnish
Related Topic
- Keep-alive or not keep-alive
- Nginx – HTTP Keep-Alive puzzle with EC2 Linux, Nginx and Chrome
- Apache: Force HTTP 1.1 or Persistent/KeepAlive connections for HTTP 1.0 requests
- Relationship between tcp state TIME_WAIT & HTTP keep-alive
- Haproxy – timeout http-request vs timeout http-keep-alive vs timeout server
- How to emulate a browser that doesn’t have “Keep alive”
Best Answer
keep-alive
is a hop-by-hop header (RFC 2616), which means the header sent from varnish to backend can be completely independent of the header sent from client to varnish, and must be handled separately. Negotiating keep-alive on the backend will not cause client to keep your connection alive.Additionally, HTTP/1.1 prefers keep-alive by default without explicit negotiation unless
Connection: close
is specified by client or server (or proxy). You should never have to forcekeep-alive
negotiation with a HTTP/1.1 client.