lua改写nginx querystring参数内容

替换走

subs_filter "src=\"(((?!https).)+?)\.js" "src=\"$1.xpja"  gir;
subs_filter ",(.+?)\.js" ",$1.xpja" gir;

替换回
lua转义用%

set_by_lua $args "

                        rurl = string.gsub(ngx.var.request_uri,'xpja','js')
                        return string.gsub(rurl,'/%?','')

                ";

效果为:

http://xxx.cn/?js=file/script/config.xpja,file/script/common.xpja,file/script/GoMobile.xpja&v=20180919-1125-36

http://xxx.cn/?js=file/script/config.js,file/script/common.js,file/script/GoMobile.js&v=20180919-1125-36

标签: nginx 输入过滤, lua

非特殊说明,本博所有文章均为博主原创。

最新文章

发表评论