mod_http: Skip IP resolution in non-proxied case 0.11
authorKim Alvefur <zash@zash.se>
Thu, 18 Feb 2021 12:00:00 +0100
branch0.11
changeset 11385 8603011e51fe
parent 11381 ab334ddc6152
child 11386 a0477656258c
child 11390 e40ba204c612
mod_http: Skip IP resolution in non-proxied case Skips doing the whole get_ip_from_request() dance if the request isn't from a proxy at all, even if the client sent the header for some reason.
plugins/mod_http.lua
--- a/plugins/mod_http.lua	Mon Feb 15 18:16:07 2021 +0100
+++ b/plugins/mod_http.lua	Thu Feb 18 12:00:00 2021 +0100
@@ -174,7 +174,7 @@
 
 module:wrap_object_event(server._events, false, function (handlers, event_name, event_data)
 	local request = event_data.request;
-	if request then
+	if request and is_trusted_proxy(request.conn:ip()) then
 		-- Not included in eg http-error events
 		request.ip = get_ip_from_request(request);
 	end