# Remote users IPV6 address shows as localhost

**URL:** https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861
**Category:** Support
**Created:** [2월 5, 2018, 8:44오후 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861 "2018-02-05T20:44:02Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![imaBASKET](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/imabasket/32/72987_2.png) [@imaBASKET](https://meta.discourse.org/u/imaBASKET)
#### Post date: [2월 5, 2018, 8:44오후 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/1 "2018-02-05T20:44:02Z")

</div>

When a user is signed into the forum under an IPV6 address their IP shows up as 127.0.0.1 in the administrator panel.  
 ![nqJowSB](https://global.discourse-cdn.com/meta/original/4X/4/8/3/483d4cb310c5c18c3891a9d80ecde018b766d691.png)

This is using the latest version.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2월 5, 2018, 8:46오후 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/2 "2018-02-05T20:46:04Z")

</div>

How is your network configured, is there an NGINX in front of your container?

---

<div class="post-metadata">

### Author: ![imaBASKET](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/imabasket/32/72987_2.png) [@imaBASKET](https://meta.discourse.org/u/imaBASKET)
#### Post date: [2월 5, 2018, 8:56오후 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/3 "2018-02-05T20:56:00Z")

</div>

I’m not really sure. I just installed discourse to check it out using the basic tutorial: [here](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md) – saw everything was fine then added a ipv6 address to my ovh machine and saw that all worked fine (disabling IPV4 on my computer to be sure) logging in and checking what my own IP showed returned that local IP. (signing in with ipv4 shows my ipv4 address just fine).

perhaps I messed something up?

---

<div class="post-metadata">

### Author: ![Sumpfling](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@Sumpfling](https://meta.discourse.org/u/Sumpfling)
#### Post date: [3월 2, 2018, 5:38오후 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/4 "2018-03-02T17:38:36Z")

</div>

Nope, you probably didn’t mess anything up.

We have the same problem with our discourse instance. (Installation on a Ubuntu host, “default” docker image etc. pp.).

We DO NOT have nginx in front of our container (i.e. on the docker-host)  
So its basically  
I-Net ---- Port-Firewall (assume: no NAT, routing done) ---- Docker-Host

If a client-request comes in via IPv4 (with an IPv4 source address) I see the correct address in the “discourse-logs”/UI  
If a client-request comes in via IPv6 (with an IPv6 source address) the UI shows 127.0.0.1

I suspect that it has something to do with the docker container not having an IPv6-address and not having nginx or a reverse-proxy before the container that could “grab” the IPv6-Address and put it into X-Forwarded-For

No solution from my side so far - I tried to enable IPv6 for my docker but failed to assign a fixed IPv6-IP to the discourse-container …

---

<div class="post-metadata">

### Author: ![Gulshan\_Kumar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gulshan_kumar/32/119562_2.png) [@Gulshan\_Kumar](https://meta.discourse.org/u/Gulshan_Kumar)
#### Post date: [9월 7, 2018, 10:23오전 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/5 "2018-09-07T10:23:35Z")

</div>

In my case,

PC is IPV4 only  
Mob is IPV4 + IPV6 supported.

I noticed, Discourse shows 127.0.0.1 IP.

 ![Screenshot_20180907-154311__01](https://global.discourse-cdn.com/meta/original/3X/1/1/11074df12955e9d918c2039e5248984feef6c15c.jpeg)  
(Ref: screenshot taken from mob, while using IPV6 network.)

Note:

- Apart from A Record, I have one AAAA DNS records also.
- I have simple installation as recommended. Nothing special.

What should I do?

Thanks

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [9월 7, 2018, 10:34오전 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/6 "2018-09-07T10:34:01Z")

</div>

Given that I can’t reproduce this problem, If you go with “Wait for fix” you could be waiting a long, _long_ time. Perhaps you could do some investigation on your system and find out what’s going wrong?

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [9월 7, 2018, 10:39오전 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/7 "2018-09-07T10:39:56Z")

</div>

Are you using a reverse proxy like nginx? It looks like a missing `X-Forwarded-For` header to me.

> [@Run other websites on the same machine as Discourse](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247):
>
> @pfaffman edited this heavily 2022.02.24. Blame me if it’s broken. If you want to run other websites on the same machine as Discourse, you need to set up an extra NGINX or HAProxy proxy in front of the Docker container. NOTE: This is for advanced admins This guide assumes you already have Discourse working - if you don’t, it may be hard to tell whether or not the configuration is working. You cannot use ./discourse-setup to set up Discourse if another server is using port 80 or 443. You will…

---

<div class="post-metadata">

### Author: ![Gulshan\_Kumar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gulshan_kumar/32/119562_2.png) [@Gulshan\_Kumar](https://meta.discourse.org/u/Gulshan_Kumar)
#### Post date: [9월 7, 2018, 4:59오후 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/8 "2018-09-07T16:59:11Z")

</div>

On a new Droplet, I have simple [installation](https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md). There is no such things like reverse proxy.

---

<div class="post-metadata">

### Author: ![Gulshan\_Kumar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gulshan_kumar/32/119562_2.png) [@Gulshan\_Kumar](https://meta.discourse.org/u/Gulshan_Kumar)
#### Post date: [9월 8, 2018, 5:09오전 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/9 "2018-09-08T05:09:35Z")

</div>

I removed AAAA record and problem resolved.

 ![Screenshot_20180908-103510__02](https://global.discourse-cdn.com/meta/original/3X/d/3/d3b4761d9fdf88237a855f29cfb3d830aee1a87d.jpeg)

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [9월 8, 2018, 5:21오전 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/10 "2018-09-08T05:21:53Z")

</div>

Well, no, not really. Your Discourse installation still isn’t reporting IPv6 addresses correctly.

---

<div class="post-metadata">

### Author: ![Gulshan\_Kumar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gulshan_kumar/32/119562_2.png) [@Gulshan\_Kumar](https://meta.discourse.org/u/Gulshan_Kumar)
#### Post date: [9월 8, 2018, 6:04오전 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/11 "2018-09-08T06:04:37Z")

</div>

I couldn’t try successfully above method. Site appears down.

[https://dl.dropboxusercontent.com/s/51sss5se1au4va3/Discourse.mp4](https://dl.dropboxusercontent.com/s/51sss5se1au4va3/Discourse.mp4)

Here’s my yml

```plaintext
## this is the all-in-one, standalone Discourse Docker container template
##
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
  - "templates/web.ssl.template.yml"
  - "templates/web.letsencrypt.ssl.template.yml"
  - "templates/web.socketed.template.yml" # <-- Added

```

---

<div class="post-metadata">

### Author: ![adorfer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adorfer/32/82089_2.png) [@adorfer](https://meta.discourse.org/u/adorfer)
#### Post date: [6월 16, 2019, 10:20오후 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/12 "2019-06-16T22:20:30Z")

</div>

> [@Gulshan\_Kumar](#):
>
> I couldn’t try successfully above method. Site appears down.

same effect here.  
How did you solve the problem?

---

<div class="post-metadata">

### Author: ![Gulshan\_Kumar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gulshan_kumar/32/119562_2.png) [@Gulshan\_Kumar](https://meta.discourse.org/u/Gulshan_Kumar)
#### Post date: [6월 18, 2019, 10:27오전 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/13 "2019-06-18T10:27:59Z")

</div>

Hey @adorfer I fixed this problem by keeping only A record with IPV4 address, and removing AAAA record which had IPV6 address.

---

<div class="post-metadata">

### Author: ![adorfer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adorfer/32/82089_2.png) [@adorfer](https://meta.discourse.org/u/adorfer)
#### Post date: [6월 18, 2019, 10:49오전 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/14 "2019-06-18T10:49:10Z")

</div>

“disabling ipv6/AAAA on the forum”: That’s no option here for us.

Any other suggestions what i can check/try/test?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [6월 19, 2019, 1:10오후 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/15 "2019-06-19T13:10:11Z")

</div>

Check [Discourse with jwilder/nginx-proxy howtos? - #6 by vitorl](https://meta.discourse.org/t/discourse-with-jwilder-nginx-proxy-howtos/94604/6) for an example of how to set `set_real_ip_from`.

---

<div class="post-metadata">

### Author: ![adorfer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adorfer/32/82089_2.png) [@adorfer](https://meta.discourse.org/u/adorfer)
#### Post date: [6월 19, 2019, 1:27오후 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/16 "2019-06-19T13:27:13Z")

</div>

I understand: i have to put manally an nginx as reverse proxy in front of discourse? (So it’s not feasable by “discourse itself”?)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [6월 19, 2019, 2:21오후 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/17 "2019-06-19T14:21:48Z")

</div>

No. You add to the app.yml to have those changes made inside the container.

Edit: See section that says

> [@Discourse with jwilder/nginx-proxy howtos?](https://meta.discourse.org/t/discourse-with-jwilder-nginx-proxy-howtos/94604/6):
>
> To fix discourse not getting the real IP from the host nginx, add this to your `app.yml` :

I think you want to add something like `set_real_ip_from YOUR_IPV6;`

---

<div class="post-metadata">

### Author: ![adorfer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adorfer/32/82089_2.png) [@adorfer](https://meta.discourse.org/u/adorfer)
#### Post date: [6월 20, 2019, 12:28오전 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/18 "2019-06-20T00:28:48Z")

</div>

But for that i need at least the initial statement for an nginx proxy to be installed in the system as multi server loadbalancing setup (as i understand the howto above)

or in other words: i no even have the stuff “to replace in the app.yaml”.  
perhaps i should look for some kind of “more complex installation”. currently my system was just running simple.

for the moment there is no such thing “replace:” in my app.yml

> [@pfaffman](#):
>
> run: - replace: filename: /etc/nginx/conf.d/discourse.conf from: “types {” to: | set\_real\_ip\_from 172.18.0.0/24; real\_ip\_header X-Forwarded-For; real\_ip\_recursive on; types {

in plus it’s unclear for me is what this syntax “`set_real_ip_from YOUR_IPV6;`” would be in reality.  
For a parameter i miss something like a “$variable” or “”, in plus the format is unclear: with netmask or is an /128 fixed?  
(in other words: a real world example would be really helpful)

---

<div class="post-metadata">

### Author: ![adorfer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/adorfer/32/82089_2.png) [@adorfer](https://meta.discourse.org/u/adorfer)
#### Post date: [6월 29, 2019, 8:13오후 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/19 "2019-06-29T20:13:40Z")

</div>

Just in order to bump this thread:  
Does anybody haven an idea what i could try out or test?

I have 3 different Discourse-Installations, on different machines and different ubuntu-versions (just for notice), with IPv6 enabled, and on all of them it’s the same:  
IPv6-users are reported with an RFC1918-IPv4 (probably from the docker-bridge) in the logs.

---

<div class="post-metadata">

### Author: ![maxx](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@maxx](https://meta.discourse.org/u/maxx)
#### Post date: [11월 18, 2019, 8:36오전 UTC](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861/20 "2019-11-18T08:36:54Z")

</div>

불행히도 저에게도 같은 문제가 발생합니다. Docker 없이 설치하면 IPv6이 깨져서 (Welcome to nginx) 오류가 발생하고, Docker를 사용하면 named 오류가 나요. 우회 방법이 떠오르지 않으시면, NAT 없이 IPv6을 다시 설정해야 할 것 같습니다.

[Next page](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861.md?page=2)
