401 Response - Add Custom Header?

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?

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