如何禁用日志记录IP地址?

对于将来的搜索者:您可以在 Discourse 实例前面使用 NGINX,您可以将 X-Real-IP 设置为固定 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;
  }

不要省略它,否则您将遇到错误并且应用程序将无法启动:

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:',
                        ^
)