mod_net_proxy/mod_net_proxy.lua
changeset 3001 97b30fec709c
parent 2979 7eb6fa9b03fd
child 3566 b33b2fbdc713
--- a/mod_net_proxy/mod_net_proxy.lua	Wed Apr 04 21:40:08 2018 +0200
+++ b/mod_net_proxy/mod_net_proxy.lua	Thu Apr 05 19:08:46 2018 +0200
@@ -344,6 +344,13 @@
 local listener = {};
 
 function listener.onconnect(conn)
+	-- Silently drop connections with an IP address of <nil>, which can happen when the socket was closed before the
+	-- responsible net.server backend was able to grab the IP address of the connecting client.
+	if conn:ip() == nil then
+		conn:close();
+		return;
+	end
+
 	-- Check if connection is coming from a trusted proxy
 	if not is_trusted_proxy(conn) then
 		conn:close();