# How to set/provide X-Forwarded-\* headers

**URL:** <https://discourse.haproxy.org/t/how-to-set-provide-x-forwarded-headers/6947>\
**Category:** Help!\
**Created:** [September 29, 2021, 8:45pm UTC](https://discourse.haproxy.org/t/how-to-set-provide-x-forwarded-headers/6947 "2021-09-29T20:45:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![xorpahy](https://avatars.discourse-cdn.com/v4/letter/x/13edae/32.png) [@xorpahy](https://discourse.haproxy.org/u/xorpahy)\
**Post date:** [September 29, 2021, 8:45pm UTC](https://discourse.haproxy.org/t/how-to-set-provide-x-forwarded-headers/6947/1 "2021-09-29T20:45:20Z")

</div>

Hi all,

I am running haproxy inside pfsense.

I need to provide X-Forwarded headers for an application (kimai 2) I just installed inside a container in my proxmox server. The app is running behind haproxy, so this is necessary in order for it to work properly. The app’s documentation provides instructions and a configuration example using nginx; see [here](https://www.kimai.org/documentation/webserver-configuration.html) and the screenshot below for details:

 ![Screen Shot 2021-09-28 at 22.41.00](https://us1.discourse-cdn.com/flex016/uploads/haproxy/original/2X/6/6389bc39c71010b7459500791f8226db3aa88024.png)

Could you please help me understand how to do this in haproxy?

What I have tried so far is to check the box “Use “forwardfor” option” under “advanced settings” in my frontend but this did not fix the issues I am having with the https url redirecting to http and the browser timing out when I try to reach the app. I guess there is something I need to do inside the app’s backend, but where exactly?

Thanks a lot in advance for any tips.

---

<div class="post-metadata">

**Author:** ![rhada](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/rhada/32/585_2.png) [@rhada](https://discourse.haproxy.org/u/rhada)\
**Post date:** [October 1, 2021, 3:17pm UTC](https://discourse.haproxy.org/t/how-to-set-provide-x-forwarded-headers/6947/2 "2021-10-01T15:17:21Z")

</div>

Hello,

You can add header on front or backend section ([HAProxy version 2.4.0 - Configuration Manual](http://cbonte.github.io/haproxy-dconv/2.4/configuration.html#4.1))

Here you can set all headers you need,

```auto
http-request set-header X-Forwarded-Proto https if { ssl_fc } # For Proto
http-request add-header X-Real-Ip %[src] # Custom header with src IP
option forwardfor # X-forwarded-for

```

Check the doc to see if you can find the vars you need
