Matching a href spec with Lua regex
nginx-forum at nginx.us
Fri Jun 27 16:57:09 UTC 2014
As usual, found my error.
The following is properly matcing the regex :
local escUri = function (m)
local _str = "href=\\"http://10.0.9.44/?_redir_="
_str = _str .. ngx.escape_uri(m) .. "\\""
local newStr, n, err = ngx.re.gsub(ngx.arg,
"href=\\"(.*)\\"", escUri, "ijox")
print(ngx.arg) --> still original text
>From my debug logs, I can see that the regex susbstitution is happening
properly. But the href still remains the same. Probably because of chunked
I will try to aggregate the response body and then do the substitution. But
if someone sees anything wrong, your help would be appreciated.
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,251234,251243#msg-251243
More information about the nginx