# 401 Response - Add Custom Header?

**URL:** <https://discourse.haproxy.org/t/401-response-add-custom-header/119>\
**Category:** Help!\
**Created:** [February 16, 2016, 7:39am UTC](https://discourse.haproxy.org/t/401-response-add-custom-header/119 "2016-02-16T07:39:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmkgreen](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/jmkgreen/32/33_2.png) [@jmkgreen](https://discourse.haproxy.org/u/jmkgreen)\
**Post date:** [February 16, 2016, 7:39am UTC](https://discourse.haproxy.org/t/401-response-add-custom-header/119/1 "2016-02-16T07:39:10Z")

</div>

I have an app (Docker Registry) behind haproxy which has a particular protocol it’s clients expect that includes a static header in ALL responses - even 4xx and 5xx.

I can easily add this header to responses within the backend but not to 401 (note: haproxy itself is performing the auth checking).

Just to confirm: is there no way of setting headers on ALL 4xx and and 5xx responses just be adding lines to `haproxy.cfg`?

---

<div class="post-metadata">

**Author:** ![ahayworth](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/ahayworth/32/11_2.png) [@ahayworth](https://discourse.haproxy.org/u/ahayworth)\
**Post date:** [March 21, 2016, 10:00pm UTC](https://discourse.haproxy.org/t/401-response-add-custom-header/119/2 "2016-03-21T22:00:25Z")

</div>

Hi jmkgreen -

I can’t seem to get this to work with the `errorfile`, `rspadd`, or `http-request add-header` directives. I suspect it would need to be added as a feature, and I’d recommend bringing it up on the mailing list.

- Andrew
