# Discourse installeren op een residentieel internet met Cloudflare Tunnel

**URL:** https://meta.discourse.org/t/install-discourse-on-a-residential-internet-with-cloudflare-tunnel/211297
**Category:** Sysadmins
**Tags:** arm, how-to, raspberry-pi, install
**Created:** [7 december 2021 om 14:02 UTC](https://meta.discourse.org/t/install-discourse-on-a-residential-internet-with-cloudflare-tunnel/211297 "2021-12-07T14:02:07Z")
**Posts on this page:** 1
**Showing post:** 42

<div class="post-metadata">

### Author: ![shyguy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shyguy/32/295079_2.png) [@shyguy](https://meta.discourse.org/u/shyguy)
#### Post date: [5 april 2023 om 22:42 UTC](https://meta.discourse.org/t/install-discourse-on-a-residential-internet-with-cloudflare-tunnel/211297/42 "2023-04-05T22:42:49Z")

</div>

yo @Falco, is the real\_ip (provided by cf as `CF-Connecting-IP` header) coming through for you in nginx logs? it’s not for me. i just see `cloudflared`’s ip.

i think one or both of these things need to be done (will follow up after investigation):

- add a `set_real_ip_from` config line to nginx for `cloudflared`’s ip. if that turns out to be the problem, then i would guess none of the other `set_real_ip_from` lines (provided by `templates/cloudflare.template.yml`) are needed for argotunnel users. and in this case, maybe a separate argotunnel template should be added to the docker repo that pulls your `cloudflared` ip from an env var or something in your main `app.yml`.
- ~~fix the `log_format`. i think this is probably not the issue, though.~~ confirmed unneeded

edit:

here’s what i’m doing to make it work:

don’t use the cloudflare template. there’s no point.  
instead, merge this into your `app.yml`:

```yaml
hooks:
  after_web_config:
    - file:
        path: /etc/nginx/conf.d/cloudflare_tunnel_real_ip.conf
        contents: |
          # restore original visitor IPs (ngx_http_realip_module)
          set_real_ip_from 10.100.20.200/32; # your cloudflared/argotunnel IP range
          real_ip_header CF-Connecting-IP;

```

that automatically ends up in the nginx `http` context btw which is appropriate.

PS: imo, for cleanliness, the cloudflare template should also generate its nginx config into a separate file instead of using `sed -i` to add it to `/etc/nginx/conf.d/discourse.conf`.

---

_[View the full topic](https://meta.discourse.org/t/install-discourse-on-a-residential-internet-with-cloudflare-tunnel/211297)._
