body_filter_by_lua_block{
local pin = ngx.var.cookie_jrapp_jsfGateway_testPin
local domain = ngx.var.host
local scheme = ngx.var.scheme
local title = "白条"
local match = ngx.arg[1]:match("<title>([^<]+)</title>")
if match then
title = match
end
if not pin then
pin = "未知pin"
end
local script = string.format('<script crossorigin=\"anonymous\" src=\"%s://%s/page-spy/index.min.js\"></script><script>window.$pageSpy=new PageSpy({ project: \"%s\", title: \"%s\" })</script></head>', scheme,domain,title, pin)
ngx.arg[1] = ngx.arg[1]:gsub("</head>", script)
}