# Preserve header capitalisation

**URL:** <https://discourse.haproxy.org/t/preserve-header-capitalisation/7511>\
**Category:** Help!\
**Created:** [March 21, 2022, 7:17am UTC](https://discourse.haproxy.org/t/preserve-header-capitalisation/7511 "2022-03-21T07:17:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![vignesh-sp](https://avatars.discourse-cdn.com/v4/letter/v/9de0a6/32.png) [@vignesh-sp](https://discourse.haproxy.org/u/vignesh-sp)\
**Post date:** [March 21, 2022, 7:17am UTC](https://discourse.haproxy.org/t/preserve-header-capitalisation/7511/1 "2022-03-21T07:17:09Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ciprian.craciun](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/ciprian.craciun/32/722_2.png) [@ciprian.craciun](https://discourse.haproxy.org/u/ciprian.craciun)\
**Post date:** [March 21, 2022, 10:46am UTC](https://discourse.haproxy.org/t/preserve-header-capitalisation/7511/2 "2022-03-21T10:46:12Z")

</div>

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](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](https://httpwg.org/specs/rfc7540.html#malformed)).

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.

---

<div class="post-metadata">

**Author:** ![vignesh-sp](https://avatars.discourse-cdn.com/v4/letter/v/9de0a6/32.png) [@vignesh-sp](https://discourse.haproxy.org/u/vignesh-sp)\
**Post date:** [March 22, 2022, 8:14am UTC](https://discourse.haproxy.org/t/preserve-header-capitalisation/7511/3 "2022-03-22T08:14:13Z")

</div>

@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 !

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [March 22, 2022, 9:03am UTC](https://discourse.haproxy.org/t/preserve-header-capitalisation/7511/4 "2022-03-22T09:03:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [March 22, 2022, 9:07am UTC](https://discourse.haproxy.org/t/preserve-header-capitalisation/7511/5 "2022-03-22T09:07:37Z")

</div>

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