# Inconsistent / missing registration & last IP

**URL:** https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386
**Category:** Support
**Created:** [July 30, 2019, 8:41am UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386 "2019-07-30T08:41:47Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![calmh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/calmh/32/115466_2.png) [@calmh](https://meta.discourse.org/u/calmh)
#### Post date: [July 30, 2019, 8:41am UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/1 "2019-07-30T08:41:47Z")

</div>

We have a Discourse installation, carried forward for several years but currently on the latest version (2.4.0beta2) using the latest Docker image, on a public IP address, no proxy or other things in front, LetsEncrypt certs.

Sometimes user registration IP and last IP works perfectly, sometimes it does not. I see no rhyme or reason. For example, here is a user created **7h** ago, with nonsense addresses:

 ![47](https://global.discourse-cdn.com/meta/original/3X/1/4/149152ab8979fee6be0da711edd9e7d7c3ea2bae.png)

Another user created **17h** ago is perfectly fine:

 ![53](https://global.discourse-cdn.com/meta/original/3X/1/d/1de56f6074d8950bdc079938e2e3c2602c78eda7.png)

And so it goes, on some users it’s cool on some others it isn’t. Any ideas what’s going on here?

One thing that strikes me now that I look at it is that it could be that these users are coming in via IPv6, as I’ve never seen an IPv6 address in these fields. Does Discourse not understand IPv6? Does the Docker proxy not understand/pass through the relevant information? Something else?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 30, 2019, 8:47am UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/2 "2019-07-30T08:47:50Z")

</div>

> [@calmh](#):
>
> Does Discourse not understand IPv6?

Discourse definitely does, but you’d need to configure your server and whatever else is in front of it so that IPv6 is functional, etc.

---

<div class="post-metadata">

### Author: ![calmh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/calmh/32/115466_2.png) [@calmh](https://meta.discourse.org/u/calmh)
#### Post date: [July 30, 2019, 8:48am UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/3 "2019-07-30T08:48:52Z")

</div>

IPv6 is very functional, and using the recommended Docker images setup with the web + data templates. There is nothing else in front. What is there we should tweak?

Mind you, out container yml has been around for a few years, although it includes the latest templates and the images themselves are rebuilt frequently. Is this something that might have changed along the way?

---

<div class="post-metadata">

### Author: ![calmh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/calmh/32/115466_2.png) [@calmh](https://meta.discourse.org/u/calmh)
#### Post date: [July 30, 2019, 9:05am UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/4 "2019-07-30T09:05:14Z")

</div>

Looks like other people running the default docker setup have the same issue.

> [@Remote users IPV6 address shows as localhost](https://meta.discourse.org/t/remote-users-ipv6-address-shows-as-localhost/79861):
>
> 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] This is using the latest version.

[https://meta.discourse.org/t/why-are-my-301-redirects-not-working-ipv6-users-also-show-as-localhost/80442/9](https://meta.discourse.org/t/why-are-my-301-redirects-not-working-ipv6-users-also-show-as-localhost/80442/9)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 30, 2019, 9:19am UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/5 "2019-07-30T09:19:33Z")

</div>

Hard to say. I just audited the last ~8 new users who signed up at `talk.commonmark.org` which is a very default [standard install](https://meta.discourse.org/t/142537?silent=true) and they all had valid IPv4 addresses for Last IP and Registration IP (sometimes the two differed, as well).

I know if user accounts come in through SSO or other unusual avenues that can affect the IPs reported there. Are all these users you are referring to regular signups through the standard new user signup dialog in Discourse?

---

<div class="post-metadata">

### Author: ![calmh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/calmh/32/115466_2.png) [@calmh](https://meta.discourse.org/u/calmh)
#### Post date: [July 30, 2019, 9:20am UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/6 "2019-07-30T09:20:16Z")

</div>

Were any of those addresses IPv6?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 30, 2019, 9:20am UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/7 "2019-07-30T09:20:37Z")

</div>

Nope, none of them were, but I don’t know if this colocation host even does IPv6.

---

<div class="post-metadata">

### Author: ![calmh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/calmh/32/115466_2.png) [@calmh](https://meta.discourse.org/u/calmh)
#### Post date: [July 30, 2019, 9:21am UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/8 "2019-07-30T09:21:18Z")

</div>

Then I’m sure it won’t exhibit the problem of showing localhost instead of IPv6 addresses for users who come in over IPv6. Doesn’t mean the problem doesn’t exist.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 30, 2019, 9:24am UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/9 "2019-07-30T09:24:00Z")

</div>

Problem doesn’t exist on Discourse official hosting, at least, and that’s IPv6 capable. Nor do I see problems on a vanilla install at a random colocation host. Not sure what else to tell you, other than you didn’t answer my rather important question

> [@codinghorror](#):
>
> I know if user accounts come in through SSO or other unusual avenues that can affect the IPs reported there. Are all these users you are referring to regular signups through the standard new user signup dialog in Discourse?

---

<div class="post-metadata">

### Author: ![calmh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/calmh/32/115466_2.png) [@calmh](https://meta.discourse.org/u/calmh)
#### Post date: [July 30, 2019, 9:26am UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/10 "2019-07-30T09:26:07Z")

</div>

Ah, yes, those are regular signups, no SSO or associated accounts.

 ![00](https://global.discourse-cdn.com/meta/original/3X/8/6/862e95f2e0e2ee028f3abe6a55bf4c5cef5b1d0e.png)

I don’t doubt that it works in your hosting, but you don’t use the “standard” Docker setup that most users do, I think? I mean, I’m sure it’s _possible_ for it to work given a proxy setting the right headers etc, the question is just if the default setup is doing that and, if not, if we can make it do so.

---

<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: [July 30, 2019, 12:45pm UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/11 "2019-07-30T12:45:49Z")

</div>

I’m pretty sure that you need to add a bit to your app.yml that tells nginx to recognize your ipv6 address and pass through the client address. I haven’t figured out how to do that yet myself, though. The topics about running a reverse proxy have ipv6 examples, which provide hints.

This is on my list of things to figure out, but I have a rather long list. I ended up disabling ipv6, I think because of this problem, but maybe due to some other ignorance of ipv6.

(Jeff you can get an ipv6 block routed, but you have to ask for it and then configure your hosts to use it.)

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [July 30, 2019, 3:02pm UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/12 "2019-07-30T15:02:39Z")

</div>

Meta is just a standard docker install + external reverse proxy and does IPv6 greatly:

 ![image](https://global.discourse-cdn.com/meta/original/3X/a/b/abfa6455073c66eaecc5fc3c5361138427cea9a4.png)

---

<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: [July 30, 2019, 4:15pm UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/13 "2019-07-30T16:15:18Z")

</div>

Is there a section in your `discourse.conf` that tells it to `set_real_ip` with your IPv6 address, something like this?

```plaintext
    - replace:
        filename: /etc/nginx/conf.d/discourse.conf
        from: "types {"
        to: |
          set_real_ip_from 192.168.1.0/24;
          set_real_ip_from 172.18.0.0/24;
          set_real_ip_from 172.17.0.0/24;
          set_real_ip_from <SOME_IP_V6_ADDRESS_THING_HERE?>
          real_ip_recursive on;
          real_ip_header X-Forwarded-For;
          types {

```

---

<div class="post-metadata">

### Author: ![calmh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/calmh/32/115466_2.png) [@calmh](https://meta.discourse.org/u/calmh)
#### Post date: [August 10, 2019, 9:37pm UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/14 "2019-08-10T21:37:28Z")

</div>

I think the external reverse proxy is the key - I don’t think this is solvable at all, or at least not easily, from just within the Docker container.

I’ve solved it now by having the Discourse Docker listen on a Unix socket and front it with a Caddy on the same machine (_outside_ Docker). The Caddy setup is trivial, includes Let’s Encrypt, and now it works as expected for IPv6 as well.

```plaintext
forum.example.com {
  proxy / unix:/var/discourse/shared/web-only/nginx.http.sock {
    transparent
    websocket
  }
}

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [February 21, 2023, 12:58pm UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/15 "2023-02-21T12:58:05Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [April 29, 2023, 7:47pm UTC](https://meta.discourse.org/t/inconsistent-missing-registration-last-ip/124386/16 "2023-04-29T19:47:51Z")

</div>


