0

I want equivalent of nginx config in haproxy. Went through lot of links but none of them mentioned anything related to below configs.

proxy_http_version 1.1;
proxy_set_header Connection "";
avaj
  • 299
  • 1
  • 5
  • 11
  • What's your actual problem? – Argus Duong Jun 02 '20 at 04:48
  • Haproxy forwards request to backend server in http1.0 but my backend server support http1.1 and above.Earlier I was able to achieve this with nginx with abv configs but not with hap. I have simple hap backend conf `backend tune server tune :443 check ssl verify none` \n \n `* HTTP 1.0, assume close after body < HTTP/1.0 503 Service Unavailable < Cache-Control: no-cache < Connection: close < Content-Type: text/html <

    503 Service Unavailable

    No server is available to handle this request. * Closing connection 0`
    – avaj Jun 02 '20 at 05:37

1 Answers1

0

You can set the preferred alpn protocol on the server line and the header with http-request set-header

# I would prefer to set this option instead of the header
option http-server-close

http-request set-header Connection "''"
server 127.0.0.1:443 ssl crt pub.pem alpn http/1.1

You can also use option http-server-close

Aleksandar
  • 2,442
  • 3
  • 15
  • 24
  • I tried your suggestion for

    `http-request set-header Connection "" server 127.0.0.1:443 ssl crt pub.pem alpn http/1.1` in both cases it throws 'hap configuration file invalid'

    `[ALERT] 153/143734 (27873) : parsing [/etc/haproxy/haproxy.cfg:86]: 'http-request set- header' expects exactly 2 arguments.

    [ALERT] 153/144145 (28175) : parsing [/etc/haproxy/haproxy.cfg:84] : 'server tune' unknown keyword 'alpn'. Registered keywords :`
    – avaj Jun 02 '20 at 09:21
  • which version of haproxy do you use? – Aleksandar Jun 02 '20 at 11:51
  • HA-Proxy version 1.8.15 2018/12/13 `http-request set-header Connection " ' ' "` \n\n this worked. http1.1 not working still – avaj Jun 02 '20 at 12:34
  • you will need to update haproxy to 2.1 to be able to set `alpn`. Do the client send the HTTP/1.0 request? Maybe you will need to set the host header `http-request set-header Host ` – Aleksandar Jun 02 '20 at 12:51