Matching a href spec with Lua regex

vamshi nginx-forum at
Fri Jun 27 14:28:29 UTC 2014


I am trying to modify the response body in the following way :

If there href="", I will convert it to

This is what I have in my nginx.conf

location / {

    body_filter_by_lua '
        local escUri = function (m)
            return "href=\\"" ..
ngx.escape_uri("$1") .. "\\""

        local newStr, n, err =[1], "href=\\"(.-)\\",
escUri, "i")

But I cannot see absolutely any change in the href part of the response 

Can someone help me understand why this is not matching ? What am I doing
wrong ?


Posted at Nginx Forum:,251234,251234#msg-251234

More information about the nginx mailing list