Safe3 / uuWAF

A industry-leading free, high-performance, AI and semantic technology web application and API security protection product - uuWAF. 一款工业级免费、高性能、高扩展,支持AI和语义引擎的Web应用和API安全防护产品-南墙。Web应用防火墙、WAF、WAAP
https://waf.uusec.com
Other
640 stars 59 forks source link

使用插件设置响应头只有部分url生效 #53

Open jinxinkai opened 4 months ago

jinxinkai commented 4 months ago
local _M = {
    version = 0.1,          --  插件版本
    name = "set_user"   --  插件名称
}

-- 返回header阶段过滤函数
function _M.resp_header_filter(waf)
    ngx.header["X-User"] = "test"
end

return _M

image image

Safe3 commented 4 months ago

目前只对返回类型为 text/html、text/plain、xml、json的内容启用插件功能,我们也看用户需求是否要全部类型都启用自定义插件功能

jinxinkai commented 4 months ago

希望能对所有type启用,特别是video类、js类

Safe3 commented 4 months ago

好的,下一版本我们将每个阶段拆分成pre和post前后两个阶段,方便你这种在pre阶段处理

Safe3 commented 4 months ago

最新的v4.0.1版已支持该功能,如下插件可满足你的需求 local _M = { version = 0.1, -- 插件版本 name = "set_user" -- 插件名称 }

function _M.resp_header_pre_filter(waf) ngx.header["X-User"] = "test" end

return _M