From 3137cead484b39fc5c42adef0e27211bc955a6ee Mon Sep 17 00:00:00 2001 From: wiaamm Date: Thu, 11 Dec 2025 17:44:56 +0200 Subject: [PATCH] fix ngx time --- .../kong/plugins/open-appsec-waf-kong-plugin/handler.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/attachments/kong/plugins/open-appsec-waf-kong-plugin/handler.lua b/attachments/kong/plugins/open-appsec-waf-kong-plugin/handler.lua index 6f8daf6..8cd3d9b 100755 --- a/attachments/kong/plugins/open-appsec-waf-kong-plugin/handler.lua +++ b/attachments/kong/plugins/open-appsec-waf-kong-plugin/handler.lua @@ -92,9 +92,12 @@ function NanoHandler.access(conf) kong.log.err("Reading request body from file start time : ", start_time) while true do - -- Check timeout - kong.log.err("Checking timeout for request body reading at ", ngx.now()) - local elapsed = ngx.now() - start_time + -- Update time and check timeout + ngx.update_time() + local current_time = ngx.now() + local elapsed = current_time - start_time + kong.log.err("Request body reading elapsed time: ", elapsed, " seconds") + if elapsed > 3 then kong.log.warn("Request body reading timeout after ", elapsed, " seconds") file:close()