lib/perus/server/app.rb in perus-0.1.6 vs lib/perus/server/app.rb in perus-0.1.7
- old
+ new
@@ -145,10 +145,15 @@
timestamp = Time.now.to_i
# update the system with its last known ip and update time
system = System.with_pk!(params['id'])
system.last_updated = timestamp
- system.ip = request.ip
+
+ if request.ip == '127.0.0.1'
+ system.ip = request.env['HTTP_X_FORWARDED_FOR']
+ else
+ system.ip = request.ip
+ end
# errors is either nil or a hash of the format - module: [err, ...]
system.save_metric_errors(params, timestamp)
# add each new value, a later process cleans up old values