Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jinxinkai opened this issue Apr 11, 2024 · 4 comments
Open

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

jinxinkai opened this issue Apr 11, 2024 · 4 comments

Comments

@jinxinkai
Copy link

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
Copy link
Owner

Safe3 commented Apr 11, 2024

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

@jinxinkai
Copy link
Author

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

@Safe3
Copy link
Owner

Safe3 commented Apr 12, 2024

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

@Safe3
Copy link
Owner

Safe3 commented Apr 16, 2024

最新的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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants