# How to set Authorization header from request and send it to backend server - haproxy

**URL:** <https://discourse.haproxy.org/t/how-to-set-authorization-header-from-request-and-send-it-to-backend-server-haproxy/6733>\
**Category:** Help!\
**Created:** [July 14, 2021, 10:25pm UTC](https://discourse.haproxy.org/t/how-to-set-authorization-header-from-request-and-send-it-to-backend-server-haproxy/6733 "2021-07-14T22:25:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saeedkhan999](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@saeedkhan999](https://discourse.haproxy.org/u/saeedkhan999)\
**Post date:** [July 14, 2021, 10:25pm UTC](https://discourse.haproxy.org/t/how-to-set-authorization-header-from-request-and-send-it-to-backend-server-haproxy/6733/1 "2021-07-14T22:25:01Z")

</div>

Config file:

listen https\_proxy  
bind 0.0.0.0:443

http-request set-var(txn.authorization) hdr(Authorization)

use\_backend node

backend node  
option forwardfor  
http-request add-header Authorization (txn.authorization)  
http-response set-header Authorization hdr(Authorization)  
http-request set-header X-Forwarded-Port %[dst\_port]  
http-request add-header X-Forwarded-Proto https if { ssl\_fc }  
server s1 0.0.0.0:8088 check

How can I pass Authorization header from request that I have set using set-var() to backend server as header.

Appreciate any help.  
Thanks in advance.

---

<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:** [July 14, 2021, 10:30pm UTC](https://discourse.haproxy.org/t/how-to-set-authorization-header-from-request-and-send-it-to-backend-server-haproxy/6733/2 "2021-07-14T22:30:19Z")

</div>

Please share the complete configuration and explain the entire configuration that you are trying to achieve, there are almost certainly multiple errors and wrong assumption here, but without context it’s impossible to help.

---

<div class="post-metadata">

**Author:** ![saeedkhan999](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@saeedkhan999](https://discourse.haproxy.org/u/saeedkhan999)\
**Post date:** [July 14, 2021, 10:36pm UTC](https://discourse.haproxy.org/t/how-to-set-authorization-header-from-request-and-send-it-to-backend-server-haproxy/6733/3 "2021-07-14T22:36:19Z")

</div>

Im sending request to haproxy with “Authorization” header. So this Authorization value header I want to send in backend as a header.

backend node  
http-request add-header Authorization (value-of-request-header)

---

<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:** [July 15, 2021, 8:43am UTC](https://discourse.haproxy.org/t/how-to-set-authorization-header-from-request-and-send-it-to-backend-server-haproxy/6733/4 "2021-07-15T08:43:16Z")

</div>

Then there is nothing for you to do. Haproxy will not remove any headers by default.
