in appactive-gateway/nginx-plugin/etc/nginx/conf/lua/util/unit_filter.lua [85:115]
function _M.getUnitForRequest(ruleParsed, isUnitEnabled)
if isUnitEnabled then
if not ruleParsed or ruleParsed["idUnitMapping"] == nil then
return -1
else
local unit, key
local idSource = ruleParsed["idSource"]
if type(idSource) == "table" then
for i = 1, #idSource do
key = getValueFromNginx(idSource[i])
if key ~= nil then
break
end
end
else
key = getValueFromNginx(idSource)
end
if key ~= nil then
ngx.var.unit_key = key
unit = getUnit(ruleParsed,key)
if unit ~= nil then
return unit
end
end
return -1
end
else
return -1
end
end