aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/http/server.lua2
-rw-r--r--plugins/mod_http.lua2
2 files changed, 3 insertions, 1 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index df87283a..ab71dbc9 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -113,6 +113,7 @@ local function noop() end
function listener.onconnect(conn)
local session = { conn = conn };
local secure = conn:ssl() and true or nil;
+ local ip = conn:ip();
session.thread = async.runner(function (request)
local wait, done;
if request.partial == true then
@@ -127,6 +128,7 @@ function listener.onconnect(conn)
end, runner_callbacks, session);
local function success_cb(request)
--log("debug", "success_cb: %s", request.path);
+ request.ip = ip;
request.secure = secure;
session.thread:run(request);
end
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua
index b9a76c90..d81f4ab7 100644
--- a/plugins/mod_http.lua
+++ b/plugins/mod_http.lua
@@ -260,7 +260,7 @@ local function is_trusted_proxy(ip)
end
local function get_ip_from_request(request)
- local ip = request.conn:ip();
+ local ip = request.ip;
local forwarded_for = request.headers.x_forwarded_for;
if forwarded_for and is_trusted_proxy(ip) then
-- luacheck: ignore 631