Forcing HAProxy to send HTTP 1.1 requests to backend server

  Kiến thức lập trình

I’m serving some legacy clients that support only HTTP/1.0. The min version that the backend server accepts is HTTP/1.1.

I’m trying to configure HAProxy so that it receives HTTP/1.0 requests and then send them as HTTP/1.1 request to the backend server.

I’ve tested some simple configuration in HAProxy that should work, but when I send HTTP/1.0 requests to HAProxy with CURL, I keep getting the response code “426 Upgrade Required” from the backend server. Apparently HAProxy keeps sending requests as HTTP/1.0 to the backend server.

This is my HAProxy config:

log local2
chroot /var/lib/haproxy
pidfile /var/run/
maxconn 40000
user haproxy
group haproxy
stats socket /var/lib/haproxy/stats
ssl-default-bind-ciphers PROFILE=SYSTEM
ssl-default-server-ciphers PROFILE=SYSTEM

mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 15000

listen farm_ssfti
bind :50121
http-request replace-header Host .
default-server check ssl verify none alpn http/1.1,h2
server ssfpi

Should this work? Is it even possible to receive requests with version 1.0 and send them to the backend server in version 1.1?


New contributor

Christian Zazueta is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.