Strange rewrite_by_lua outcome
nginx at nginxuser.net
Mon Oct 17 16:33:20 UTC 2011
On 17 October 2011 08:03, Tim Mensch <tim-nginx at bitgems.com> wrote:
> On 10/16/2011 10:50 PM, Nginx User wrote:
>> BTW this works fine even though it has "\":
>> local query_string = ngx.re.match(ngx.var.request_uri,
> You're just doing "\." in that line. If Nginx strips that "\", then it ends
> up in Lua as ".", which changes the meaning but will happen to work in most
> cases (though it would match sqlpatch_php and other similar strings, and not
> just sqlpatch.php, since the "." will be the wildcard).
Let me get this right. Do I need to always escape the "\" inserted to
escape "." in "\." in lua and then add another couple of "\"s? I.E.,
do I need to do "sqlpatch\\\\.php" to get "sqlpatch\.php" passed to
the regex finally? IOW, do I basically replace each "\" with "\\\\"?
If I understand agentzh, the rewrite module handles this behind the
scenes and allows us to use familiar syntax. Is that right?
More information about the nginx