All IPs recorded as 127.0.0.1

I’m having an issue where all my user IPs are recorded as 127.0.0.1

Been reading some related topics, and still can’t quite figure out what’s going on:.

  1. I’m using nginx as a reverse proxy on a separate server.
  2. I’ve added this to my container’s nginx configuration: set_real_ip_from 123.123.123.123; (Using IP of front end proxy)
  3. The nginx access.log inside the container shows the correct visitor IP
  4. Discourse production.log shows 127.0.0.1 for all requests

Any ideas as to why the application isn’t picking up the real IP? Thanks!

Because the Discourse nginx is misconfigured, or the upstream proxy isn’t sending the appropriate headers to pass on the forwarded IP address. Without seeing the innards of your config, it’s impossible to know for sure.

4 Likes

I also noticed that I have a very limited range of Screened IPs (see screenshot below), so I wonder whether this points to a similar misconfiguration? The IPs of my users (registration, last IP address) are shown correctly, though. (But when people sign up via invite, their registration IP is not logged. I’m assuming that is by design.)

Why/when exactly do IPs get on the watchlist?

When you delete a user and say “ban IP”. You’re looking at what appears to be the default list. You either have a new site, never had a spam attack, or both.

4 Likes

Got it working! I had followed this guide, but didn’t realize I should have taken out the replace command for the Fastly CDN

I also added this to my container app.yml so it would recognize my upstream proxy.

- replace:
       filename: /etc/nginx/conf.d/discourse.conf
       from: keepalive_timeout 65;
       to: |
          keepalive_timeout 65;
          set_real_ip_from [proxy IP];
4 Likes