Remote users IPV6 address shows as localhost


#1

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.

This is using the latest version.


Why does all my users have 127.0.0.1 seen last Ip addres
(Sam Saffron) #2

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


#3

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?


(Sumpfling) #4

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 …


(Ultra Noob) #5

In my case,

PC is IPV4 only
Mob is IPV4 + IPV6 supported.

I noticed, Discourse shows 127.0.0.1 IP.


(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


(Matt Palmer) #6

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?


(Gerhard Schlager) #7

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


(Ultra Noob) #8

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


(Ultra Noob) #9

I removed AAAA record and problem resolved.


(Matt Palmer) #10

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


(Ultra Noob) #11

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