# Add authorization header per backend

**URL:** <https://discourse.haproxy.org/t/add-authorization-header-per-backend/8676>\
**Category:** Help!\
**Created:** [May 4, 2023, 10:17pm UTC](https://discourse.haproxy.org/t/add-authorization-header-per-backend/8676 "2023-05-04T22:17:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abolinhas](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/abolinhas/32/1612_2.png) [@abolinhas](https://discourse.haproxy.org/u/abolinhas)\
**Post date:** [May 4, 2023, 10:17pm UTC](https://discourse.haproxy.org/t/add-authorization-header-per-backend/8676/1 "2023-05-04T22:17:17Z")

</div>

I want to add an autorization header per backend, it’s possible?  
I already try this but is not working

```auto
backend default_ad_agent
        mode http
        http-request add-header Authorization "xxxx" if { srv_id 1 }
        http-request add-header Authorization "yyyy" if { srv_id 2 }
        server 192.168.60.32 192.168.60.32:8080 id 1 weight 1 maxconn 10000 check inter 60000 rise 2 fall 3
        server 192.168.60.31 192.168.60.31:8080 id 2 weight 1 maxconn 10000 check inter 60000 rise 2 fall 3

```

---

<div class="post-metadata">

**Author:** ![abolinhas](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/abolinhas/32/1612_2.png) [@abolinhas](https://discourse.haproxy.org/u/abolinhas)\
**Post date:** [June 9, 2023, 6:41pm UTC](https://discourse.haproxy.org/t/add-authorization-header-per-backend/8676/2 "2023-06-09T18:41:05Z")

</div>

No one can help me on this?

---

<div class="post-metadata">

**Author:** ![MaEh86](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@MaEh86](https://discourse.haproxy.org/u/MaEh86)\
**Post date:** [June 15, 2023, 11:28am UTC](https://discourse.haproxy.org/t/add-authorization-header-per-backend/8676/3 "2023-06-15T11:28:07Z")

</div>

Hello,

what doesn’t work in detail? Can you see your header in the backend-server? I did a short test and can see the header with wireshark.

 ![15-06-2023_13-26-01](https://us1.discourse-cdn.com/flex016/uploads/haproxy/original/2X/7/7667914792d581a331c4933fd8f57c19e67f0c59.png)

Update: sorry, missunderstood your question a little bit. Seems, the request-header can’t be added after the backend-decision. It is possible, that these headers are added before the decision, which backend will be used, but not sure 😕

best regards,  
Markus
