lua脚本动态插入script标签 在nginx层面

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.arg1: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.arg1 = ngx.arg1:gsub("</head>", script)

}

相关推荐
似的8356 小时前
一步一步学习使用FireMonkey动画() 使用TAnimator类创建动画
linux·学习·nginx
闪亮的路灯1 天前
威联通QTS使用自带web服务期代理前端(类似nginx)
前端·nginx·威联通
星空露珠2 天前
迷你世界3.0API,事件监听
开发语言·数据结构·数据库·游戏·lua
難釋懷2 天前
Nginx外置缓存-error_page
运维·nginx·缓存
怪味趣多2 天前
r创建动画。 . 使用TFloatAnimation通过改变图片的位置创建动车。 . 使用TPathAnimation创建路径动画。 ...
运维·nginx
七七powerful3 天前
为离线的bcliunx euler&龙晰 配置 yum源 nginx代理
nginx·yum·bclinux
AlbertS3 天前
Let‘s Encrypt 证书自动续期并自动应用到Nginx
运维·nginx·ssl·cerbot·renew·续期
ellis19703 天前
u3d插件xLua[二]例2:U3DScripting,例3:UIEvent分析
unity·lua
Python私教3 天前
Godot 4 AnimatedSprite2D 实战:让待机与移动动画自动切换
nginx·游戏引擎·godot·动画·游戏开发
泡沫冰@3 天前
上章节中文件的讲解
前端·网络·nginx