diff --git a/lib/middleware/request_tracker.rb b/lib/middleware/request_tracker.rb index cee0f5535cf..f0ce009a6cf 100644 --- a/lib/middleware/request_tracker.rb +++ b/lib/middleware/request_tracker.rb @@ -166,7 +166,7 @@ class Middleware::RequestTracker log_request_info(env, result, info) unless env["discourse.request_tracker.skip"] end - PRIVATE_IP = /^(127\.)|(192\.168\.)|(10\.)|(172\.1[6-9]\.)|(172\.2[0-9]\.)|(172\.3[0-1]\.)|(::1$)|([fF][cCdD])/ + PRIVATE_IP ||= /^(127\.)|(192\.168\.)|(10\.)|(172\.1[6-9]\.)|(172\.2[0-9]\.)|(172\.3[0-1]\.)|(::1$)|([fF][cCdD])/ def is_private_ip?(ip) ip = IPAddr.new(ip) rescue nil