lua plugin system
This commit is contained in:
parent
dcb1a04d53
commit
8f81538b0d
3 changed files with 83 additions and 3 deletions
15
rootfs/etc/nginx/lua/plugins/hello_world/main.lua
Normal file
15
rootfs/etc/nginx/lua/plugins/hello_world/main.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
local _M = {}
|
||||
|
||||
function _M.rewrite()
|
||||
ngx.req.set_header("x-hello-world", "1")
|
||||
end
|
||||
|
||||
function _M.access()
|
||||
local ua = ngx.var.http_user_agent
|
||||
|
||||
if ua == "hello" then
|
||||
ngx.exit(403)
|
||||
end
|
||||
end
|
||||
|
||||
return _M
|
||||
Loading…
Add table
Add a link
Reference in a new issue