Remote users IPV6 address shows as localhost

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


I’m not really sure. I just installed discourse to check it out using the basic tutorial: here – 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?

1 Like

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

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 …

1 Like

In my case,

PC is IPV4 only
Mob is IPV4 + IPV6 supported.

I noticed, Discourse shows IP.

(Ref: screenshot taken from mob, while using IPV6 network.)


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

What should I do?


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?

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


On a new Droplet, I have simple installation. There is no such things like reverse proxy.

I removed AAAA record and problem resolved.

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


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

Here’s my yml

## 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
## visit to validate this file as needed

  - "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

same effect here.
How did you solve the problem?

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

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

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

1 Like

Check Discourse with jwilder/nginx-proxy howtos? for an example of how to set set_real_ip_from.

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

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

Edit: See section that says

I think you want to add something like set_real_ip_from YOUR_IPV6;

1 Like

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

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)

1 Like

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.


Sadly the same for me. Installing without Docker results in broken IPv6 (Welcome to nginx), with Docker results in the named error. IPv6 would need to be redone without NAT, if you don’t have any idea for a workarround.

I’ve just noticed that the IP addresses for a lot of members on my forum are being stored as I’m not running a reverse proxy or anything - there’s nothing between you and Discourse’s Docker. Any ideas?

1 Like