diff --git a/ctx.lua b/ctx.lua index 6785f35..78e3239 100644 --- a/ctx.lua +++ b/ctx.lua @@ -34,15 +34,16 @@ function ctx:onRequest() for callback_regex, callback_function in pairs(module.callbacks) do local match, error = ngx.re.match(request_uri, callback_regex) if match then - table.insert(callbacks_to_call, {callback_function, module_config, state}) + table.insert(callbacks_to_call, {module, callback_function, module_config, state}) end end end - for _,tuple in ipairs(callbacks_to_call) do - local callback_function, config, state = unpack(tuple) + for _, tuple in ipairs(callbacks_to_call) do + local module, callback_function, config, state = unpack(tuple) local status_code, body = callback_function(config, state) if status_code ~= nil then + log('filtered by module ' .. module.name) ngx.status = status_code ngx.say(body or "request denied") ngx.exit(status_code)