0

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?

HappyCoder86
  • 103
  • 3

1 Answers1

1

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 force keep-alive negotiation with a HTTP/1.1 client.

Andrew Domaszek
  • 5,103
  • 1
  • 14
  • 26