Load balancer for proxies

Hi, I have a few custom-written HTTP proxies (CONNECTed by client). I want to have a round-robin load balancer (HAProxy) in-front of them so that a single IP address can be used by the client to access a pool of rotating backend HTTP proxies. HAProxy will mainly forward incoming requests to the backend proxies, and then relay the response back to the client.

I’m guessing that this can be done using the option http_proxy configuration. Is that correct?

I also want HAProxy to retry the next backend once only in case of a backend timeout or a specific status code (e.g. HTTP 520). How can I configure this custom rule?

Lastly, does it make sense (and is it possible) to explicitly gzip compress and keep-alive connection between HAProxy and backend proxies, or will it just pass the HTTP request as-is from the client, in which case the request will include compression headers.

Any tips or suggestions will be useful. Thank you!