Does ngx.redirect includes uri args by default? if not what it the best way to add args while redirect.
Appending ..ngx.var.args looks to be a hard way as it requires an if exists condition before appending(else throws a error on trying to append nil to string).
Example:
if string.find(ngx.var.uri, "^/hello/world/$") then
if ngx.var.args ~= nil then
return ngx.redirect("/new/hello-world/"..ngx.var.args)
else
return ngx.redirect("/new/hello-world/")
end
end
I am trying to reduce the extra if on args check. Any help appreciated.