提交 ede8bc0c 编写于 作者: G George Claghorn 提交者: George Claghorn

Merge pull request #33489 from Atul9/remote-ip

Log the remote IP addr of clients behind a proxy
上级 dd113369
......@@ -50,7 +50,7 @@ def started_request_message(request) # :doc:
'Started %s "%s" for %s at %s' % [
request.request_method,
request.filtered_path,
request.ip,
request.remote_ip,
Time.now.to_default_s ]
end
......
......@@ -53,6 +53,12 @@ def logs
wait
assert_match 'Started HEAD "/"', logs
end
test "logger logs correct remote IP address" do
get "/", {}, { "REMOTE_ADDR" => "127.0.0.1", "HTTP_X_FORWARDED_FOR" => "1.2.3.4" }
wait
assert_match 'Started GET "/" for 1.2.3.4', logs
end
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册