From 7e282d4c55c4c69230869c7366f9ee6c25f3dbe7 Mon Sep 17 00:00:00 2001 From: Jack Tysoe Date: Tue, 9 Jul 2024 23:13:29 +0100 Subject: [PATCH] fix(ai-proxy)(general): body_filter should not run on failure --- kong/plugins/ai-proxy/handler.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kong/plugins/ai-proxy/handler.lua b/kong/plugins/ai-proxy/handler.lua index 63357dbad84..88e49a8ac55 100644 --- a/kong/plugins/ai-proxy/handler.lua +++ b/kong/plugins/ai-proxy/handler.lua @@ -339,6 +339,11 @@ function _M:body_filter(conf) return end + -- only act on 200 in first release - pass the unmodifed response all the way through if any failure + if kong.response.get_status() ~= 200 then + return + end + local route_type = conf.route_type if kong_ctx_shared.skip_response_transformer and (route_type ~= "preserve") then