Skip to content

Commit 497b78d

Browse files
author
Konstantin Krauss
committed
Update log_middleware.rb
Add option to get IP from `X-REAL-IP` header.
1 parent 0c20e29 commit 497b78d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/concise_logging/log_middleware.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def initialize(app)
66

77
def call(env)
88
request = ActionDispatch::Request.new(env)
9-
Thread.current[:logged_ip] = request.ip
9+
Thread.current[:logged_ip] = request.env['HTTP_X_REAL_IP'] || request.ip
1010
@app.call(env)
1111
ensure
1212
Thread.current[:logged_ip] = nil

0 commit comments

Comments
 (0)