This is an automated email from the ASF dual-hosted git repository.

nic443 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 184678ccc chore: add ngx.flush after ngx.print (#1194) (#12988)
184678ccc is described below

commit 184678ccc1b3ca97bb0a9c5df2dfc92286d04514
Author: Nic <[email protected]>
AuthorDate: Tue Feb 10 09:37:03 2026 +0800

    chore: add ngx.flush after ngx.print (#1194) (#12988)
    
    Signed-off-by: Nic <[email protected]>
---
 apisix/plugin.lua | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/apisix/plugin.lua b/apisix/plugin.lua
index 1acc70455..308749cc9 100644
--- a/apisix/plugin.lua
+++ b/apisix/plugin.lua
@@ -25,6 +25,7 @@ local re_split      = require("ngx.re").split
 local ngx           = ngx
 local ngx_ok        = ngx.OK
 local ngx_print     = ngx.print
+local ngx_flush     = ngx.flush
 local crc32         = ngx.crc32_short
 local ngx_exit      = ngx.exit
 local pkg_loaded    = package.loaded
@@ -1349,6 +1350,7 @@ function _M.lua_response_filter(api_ctx, headers, body)
     if not plugins or #plugins == 0 then
         -- if there is no any plugin, just print the original body to 
downstream
         ngx_print(body)
+        ngx_flush()
         return
     end
     for i = 1, #plugins, 2 do
@@ -1377,6 +1379,7 @@ function _M.lua_response_filter(api_ctx, headers, body)
         ::CONTINUE::
     end
     ngx_print(body)
+    ngx_flush()
 end
 
 

Reply via email to