# Convert HTTP/1.0 from clients into HTTP/1.1 to backends

**URL:** <https://discourse.haproxy.org/t/convert-http-1-0-from-clients-into-http-1-1-to-backends/3978>\
**Category:** Help!\
**Created:** [June 28, 2019, 8:09am UTC](https://discourse.haproxy.org/t/convert-http-1-0-from-clients-into-http-1-1-to-backends/3978 "2019-06-28T08:09:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cuu508](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/cuu508/32/859_2.png) [@cuu508](https://discourse.haproxy.org/u/cuu508)\
**Post date:** [June 28, 2019, 8:09am UTC](https://discourse.haproxy.org/t/convert-http-1-0-from-clients-into-http-1-1-to-backends/3978/1 "2019-06-28T08:09:14Z")

</div>

My HAProxy 1.9.x instance is receiving a mix of HTTP/1.0 and HTTP/1.1 requests from clients (clients are mostly things like curl, wget and http libraries, not web browsers).

I can see from the logs that when HAProxy receives a HTTP/1.0 request from a client, it makes a HTTP/1.0 request to a backend. I.e., it doesn’t convert it to HTTP/1.1 before handing off to the backend. This is messing with keepalive connections to the backend: for HTTP/1.0 requests, the backend server (nginx) returns a “Connection: Close” response header, and Haproxy closes that specific connection.

Is it possible to tell Haproxy to only ever make HTTP/1.1 requests to backends?

I’m aware of the possibility to use HTTP/2 to backends with http-use-htx. But I’d like to keep things plain and simple if possible.

---

<div class="post-metadata">

**Author:** ![capflam](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/capflam/32/236_2.png) [@capflam](https://discourse.haproxy.org/u/capflam)\
**Post date:** [June 28, 2019, 9:09am UTC](https://discourse.haproxy.org/t/convert-http-1-0-from-clients-into-http-1-1-to-backends/3978/2 "2019-06-28T09:09:35Z")

</div>

You may enable the HTX with the option `http-use-htx` both on your frontend and your backend (or you may set it in your defaults section). And then you may add the header `Connection: keep-alive` on your HTTP/1.0 requests by adding the following http-request rule:

```auto
  http-request set-header Connection "keep-alive" if { req.ver "1.0" }

```

It doesn’t work with the HTTP legacy mode because the server connection depends on the client one more deeply than with the HTX mode. Note also, with HAProxy 2.0, the HTX is enabled by default. It also tries, as far as possible, to keep the server connection alive. So, in your case, the http-request is also unnecessary. It works “by design” with HAProxy 2.0 🙂

---

<div class="post-metadata">

**Author:** ![cuu508](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/cuu508/32/859_2.png) [@cuu508](https://discourse.haproxy.org/u/cuu508)\
**Post date:** [June 28, 2019, 9:23am UTC](https://discourse.haproxy.org/t/convert-http-1-0-from-clients-into-http-1-1-to-backends/3978/3 "2019-06-28T09:23:37Z")

</div>

Cool, thanks, I will try that!

And yes, will eventually switch to HAProxy 2.0. I’m very new to HAProxy and want to start out with the mature version, before jumping on to the just-released version…
