# How to use FORWARDED\_HEADER

**URL:** <https://forum.genieacs.com/t/how-to-use-forwarded-header/1086>\
**Category:** Uncategorized\
**Created:** [September 24, 2020, 1:58pm UTC](https://forum.genieacs.com/t/how-to-use-forwarded-header/1086 "2020-09-24T13:58:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![myreczek](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/myreczek/32/303_2.png) [@myreczek](https://forum.genieacs.com/u/myreczek)\
**Post date:** [September 24, 2020, 1:58pm UTC](https://forum.genieacs.com/t/how-to-use-forwarded-header/1086/1 "2020-09-24T13:58:48Z")

</div>

Hi,

I have put Genieacs behing Apache proxy and everything works, except the CWMP logs show localhost as the request source.

How to use the FORWARDED\_HEADER to force logging the real IP of the CPE?

I have set:

`export GENIEACS_FORWARDED_HEADER=X-Forwarded-For`

but still having 127.0.0.1 as the request source in the logs.

I’m using Genieacs 1.2.1.

Thanks

---

<div class="post-metadata">

**Author:** ![zaidka](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/zaidka/32/9_2.png) [@zaidka](https://forum.genieacs.com/u/zaidka)\
**Post date:** [September 25, 2020, 2:47am UTC](https://forum.genieacs.com/t/how-to-use-forwarded-header/1086/2 "2020-09-25T02:47:56Z")

</div>

The value of the environment variable `GENIEACS_FORWARDED_HEADER` should be an IP or list of IPs or CIDRs from which to rocognize the `Forwarded` HTTP header. That is, it should be the IP of your proxy server(s). Example:

```
192.168.0.1/24, 10.0.0.1

```

Note that it doesn’t support `X-Forwarded-For`. Only the new standard `Forwarded` header is supported. See [https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded)

---

<div class="post-metadata">

**Author:** ![myreczek](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/myreczek/32/303_2.png) [@myreczek](https://forum.genieacs.com/u/myreczek)\
**Post date:** [September 25, 2020, 6:46am UTC](https://forum.genieacs.com/t/how-to-use-forwarded-header/1086/3 "2020-09-25T06:46:00Z")

</div>

I eventually found it requires new Forwarded header. Will have to switch to Nginx as Apache apparently does not support this.

---

<div class="post-metadata">

**Author:** ![gregw](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/gregw/32/351_2.png) [@gregw](https://forum.genieacs.com/u/gregw)\
**Post date:** [December 4, 2020, 1:32pm UTC](https://forum.genieacs.com/t/how-to-use-forwarded-header/1086/4 "2020-12-04T13:32:26Z")

</div>

I wanted to log the correct client IP as well. As of Apache 2.4.37 (RHEL/CentOS 8) the header is not natively supported. I did get it working by manually creating the needed **Forwarded:** header

Apache and GenieACS are running on the same host. GenieACS bound to 127.0.0.1 so will only ever see queries from 127.0.0.1

> ```
> GENIEACS_FORWARDED_HEADER=127.0.0.1
> 
> ```

I added the following to my apache config in my acs virtualhost

> ```
> ProxyAddHeaders Off
> RequestHeader set Forwarded expr=for=%{REMOTE_ADDR}
> 
> ```

---

<div class="post-metadata">

**Author:** ![myreczek](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/myreczek/32/303_2.png) [@myreczek](https://forum.genieacs.com/u/myreczek)\
**Post date:** [December 4, 2020, 2:03pm UTC](https://forum.genieacs.com/t/how-to-use-forwarded-header/1086/5 "2020-12-04T14:03:20Z")

</div>

I can confirm this works with Apache 2.46 on FreeBSD 11.4.  
Thank you!
