Limit total response time of an HTTP backend

Hi

I’m using HAProxy as an HTTP frontend to a backend S3-like service that provides large-ish downloads. Usually those downloads finish in less than an hour, but sometimes, due to bad network conditions, it can take up to 7-8 hours for a download to finish.

This is however a problem for our backend, which as a bug related to very long downloads and a work-around for this problem is to limit the time a download is allowed to take. That is, I’d like responses that take more than 12 hours to be cancelled.

I’ve already looked at the documentation, and it isn’t obvious to me how I should implement that. The server/client timeouts don’t seem to apply, since during those slow downloads the speed slows down to a trickle, but there is still ongoing traffic.

The same is true for http-request timeouts, since the request headers would have been sent already, with only the response remaining.

Is there anything I can use to stop otherwise valid connections/sessions, if they take very long?

Cheers,

Denis