HAProxy community

Http/2 rewriting headers doesn't work


I have a backend that is setup serving requests as http://fakehost, whilst my haproxy is configured to serve requests for http://realhost. I want to enable HTTP/2, so I added alpn h2,http/1.1 to my config. However the rule for rewriting the Host: header no longer works after making this change. My simplified config is listed below. Is modifying headers supported with HTTP/2, and if so, how?

frontend a
  bind ... alpn h2,http/1.1
  default_backend b

backend b
  reqrep ^Host:\ realhost Host:\ fakehost


I replaced reqrep with reqirep and now it works. Not sure why case-insensitive match would work here, as apart from Host everything else is lowercase.


In H2, the header names and values are always lowercase, so the header is actually host.