diff --git a/apisix/plugins/brotli.lua b/apisix/plugins/brotli.lua index 031bd8ea9fd3..8a24be7ee068 100644 --- a/apisix/plugins/brotli.lua +++ b/apisix/plugins/brotli.lua @@ -222,8 +222,8 @@ function _M.header_filter(conf, ctx) ctx.brotli_matched = true ctx.compressor = compressor - core.response.clear_header_as_body_modified() - core.response.add_header("Content-Encoding", "br") + ngx.header.content_length = nil + ngx.header.content_encoding = 'br' end