My first time, I try Lua script, I want to match on string (user-Agent), multiple substring to exclude them when it is match.
pattern string is User-Agent pattern, and the multiple string are google, safari and edge
local m, err = ngx.re.match(ngx.req.get_headers()['User-Agent'], "(*google*|*safari*|*edge*)", "io")
if not m
then
..
end
The problem User-Agent contain google, safari, edge string is still present on my request.
For instance User-Agent :
Mozilla/5.0 (**google**; CPU iPhone OS 14_4 like Mac OS X)
Mozilla/5.0 (**safari**; CPU iPhone OS 15_1 like Mac OS X)
Timescode_RESTClient **edge** alpha
I want to exclude them.