Preserve header capitalisation

We have a load of applications that requires headers to be received as sent by the server, but by default haproxy lowercases all the header names.

We looked at h1-case-adjust option, but this requires a predefined k:v pair to work, we do not know them.

Is there any workaround to achieve this or is there any feature request available for this purpose?

Are you perhaps using HTTP/2 on the server side?

Because in this case, what you are observing is not something HAProxy related, instead it is part of the HTTP/2 standard, as can be seen in RFC 7540:
=> https://httpwg.org/specs/rfc7540.html#HttpHeaders

Just as in HTTP/1.x, header field names are strings of ASCII characters that are compared in a case-insensitive fashion. However, header field names MUST be converted to lowercase prior to their encoding in HTTP/2. A request or response containing uppercase header field names MUST be treated as malformed (Section 8.1.2.6).

Even in the case of HTTP/1, and even if you convince HAProxy to not change the casing, because your servers don’t correctly handle headers in case-insensitive mode, end especially if they are exposed to the internet, they might be open to some security issues due to the fact that they fail to recognize or handle headers that happen to use another casing than you are expecting.

@ciprian.craciun thank you for the response, the backends are not HTTP/2. We are aware of the RFC specs. Even though HTTP/1.1 header names are case insensitive, the clients are not obeying the spec. Need a way to support these http clients.

@lukastribus any workaround that you can suggest will be very helpful, thank you again !

Disable everything h2 related and put no option http-use-htx in your global or default sections. This downgrades haproxy entirely to H1.

So you are only buying time and this only works in older releases.

More specifically: this will only work in haproxy-2.0 which is only supported for another year.