How to disable logging IP address?

Hello,
I successfully run discourse and now I’d like to disable logging users’ IP address.
There are many discussion of it as part of EU GDPR(2018, 2019), but I could not find the concrete solution for it.

https://meta.discourse.org/t/disabling-unnecessary-logging-for-gdpr-compliance/86301

I appreciate if someone guides me to find it!

1 Like

Hello @codinghorror,
Is there any “How to” for your suggestion on Possible to not log user IP addresses? - #10 by codinghorror?
I see there were many demand on disabling IP logging in 2018 due to EU GDPR, so I expect there is simple solution already for this.

You need ip addresses to fight abuse, so I think that most people have decided that the way that Discourse manages up addresses is not in violation of gdpr. I think that no plugin emerged to do what you ask.

A simple solution is to use an external reverse proxy and don’t configure discourse to use the reverse proxy ip address (which happens by default).

4 Likes

For future searchers: you can use NGINX in front of the discourse instance, you can set the X-Real-IP to a fixed IP 127.0.0.1:

  location / {
    proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock:;
    proxy_set_header Host $http_host;
    proxy_http_version 1.1;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header X-Real-IP 127.0.0.1;
  }

Do not leave it out because you will get errors and the app will fail to start:

Completed 500 Internal Server Error in 149ms (Views: 11.1ms | ActiveRecord: 0.0ms | Allocations: 70970)
PG::InvalidTextRepresentation (ERROR:  invalid input syntax for type inet: "unix:"
LINE 7:     client_ip = 'unix:',
                        ^
)