# HTTP2/HTTP1.1 to one backend

**URL:** <https://discourse.haproxy.org/t/http2-http1-1-to-one-backend/5122>\
**Category:** Help!\
**Created:** [April 23, 2020, 8:49am UTC](https://discourse.haproxy.org/t/http2-http1-1-to-one-backend/5122 "2020-04-23T08:49:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vladislas](https://avatars.discourse-cdn.com/v4/letter/v/3be4f8/32.png) [@Vladislas](https://discourse.haproxy.org/u/Vladislas)\
**Post date:** [April 23, 2020, 8:49am UTC](https://discourse.haproxy.org/t/http2-http1-1-to-one-backend/5122/1 "2020-04-23T08:49:06Z")

</div>

Hello!  
Help me please!  
I have backend which supports http2 and http1.1. I need to do SSL offload on haproxy side, then send it reencryted to backend. So I have a problem with the following config:

frontend test\_tcp443  
bind 10.220.44.3:443 ssl crt test.pem alpn h2,http/1.1  
option http-use-htx  
default\_backend test\_tcp8443

backend test\_tcp8443  
balance roundrobin  
option tcp-check  
option http-use-htx  
server test 10.220.44.3:8443 check ssl verify none alpn h2,http/1.1

If I send http2 request to frontend, it works as expected.

1. Frontend receive http2
2. Haproxy negotiate over alpn with backend server to use http2
3. Haproxy send http2 traffic to backend

If I send http1.1 request to frontend, there is some trouble.

1. Frontend receive http1
2. Haproxy negotiate over alpn with backend server to use http2
3. Haproxy send http2 traffic to backend  
In this scenario I have broken websocket protocol.

So I have a question. How to create configuration that supports the following tasks:

1. SSL offload, reencrypt, sends SSL to backend
2. Sends HTTP2 request over HTTP2 to backend
3. Sends HTTP1 request over HTTP1 to backend

---

<div class="post-metadata">

**Author:** ![Baptiste](https://avatars.discourse-cdn.com/v4/letter/b/cab0a1/32.png) [@Baptiste](https://discourse.haproxy.org/u/Baptiste)\
**Post date:** [April 24, 2020, 6:33am UTC](https://discourse.haproxy.org/t/http2-http1-1-to-one-backend/5122/2 "2020-04-24T06:33:28Z")

</div>

You can try a solution with 2 backends, one for HTTP1/1 and one for HTTP/2 and in the frontend you can take a routing decision, such as:

```
use_backend bhttp2 if { req.ver 2.0 }
```

---

<div class="post-metadata">

**Author:** ![Vladislas](https://avatars.discourse-cdn.com/v4/letter/v/3be4f8/32.png) [@Vladislas](https://discourse.haproxy.org/u/Vladislas)\
**Post date:** [April 24, 2020, 8:13am UTC](https://discourse.haproxy.org/t/http2-http1-1-to-one-backend/5122/3 "2020-04-24T08:13:52Z")

</div>

I’m very grateful to you! It works as expected
