当前位置:网站首页>Skillfully use NGX_ Lua makes traffic grouping
Skillfully use NGX_ Lua makes traffic grouping
2022-07-28 10:11:00 【InfoQ】
background
- Test environment parallel testing : A service has multiple requirements tested at the same time , need nginx Forward the traffic to the designated testing machine according to the specific information .
- Full link piezometry : The flow is indistinguishable , Affect online users , The pressure test can only be carried out at the low peak of the business , Need to be on duty , The high cost , Need to be able to isolate traffic , Pressure measurement can be carried out at any time .
- Grayscale Publishing : need nginx According to the specified information, the traffic is forwarded to the specified gray-scale machine .
ngx_lua modular

ngx_lua Operation instruction
Set the flow label
Mode one :

...
if (tag == "" or checkTag(host_pass, tag) == false)
then
return host_pass;
end
...
return host_pass.."_"..tag;
set_by_lua_file $host_pass set_tag.lua;
Mode two :

...
local host = ngx.var.host
local hostList = split(host, ".")
local subDomain = split(hostList[1], "-")
...
ngx.req.set_header("global-route-tag", subDomain[2])
ngx.header["global-route-tag"] = subDomain[2]
...
local test_host = ipList[1].."."..hostList[2].."."..hostList[3]
return test_host
set_by_lua_file $test_host set_test_servers.lua ;
location / {
...
proxy_pass http://$host_pass;
proxy_set_header Host $test_host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
}
combination dyups Online and offline tagging Services
Realization effect

summary
- WEB Application firewall (waf);
- Current limiting ;
- Downgrade ;
- Service quality monitoring .
About author
边栏推荐
- web之圣杯和双飞翼布局、float、clear、both
- B2B2C系统亮点是什么?如何助力珠宝首饰企业打造全渠道多商户商城管理体系
- Holy Grail of web and double wing layout, float, clear, both
- 7.27 minimum spanning tree phased test problem solution
- LinkedList source massage, ah comfortable
- What are the advantages of MRO purchasing website for industrial products? One article will help you understand
- 不登高山,不知天之高也;不临深溪,不知地之厚也
- Openatom openharmony sub forum, see you today at 14:00! Wonderful release of memorabilia attached
- Redis interview questions must be known and learned
- OSPF的拓展配置,选路原则,防环及重发布
猜你喜欢
Edge team explains how to improve the comprehensive performance experience through disk cache compression technology

定了!就在7月30日!
![[ESP32][esp-idf] AP+STA实现无线桥接 中转wifi信号](/img/bf/0a968064a8f7c11b86a2a2820208e6.png)
[ESP32][esp-idf] AP+STA实现无线桥接 中转wifi信号

Plato farm - a farm meta universe game with Plato as the goal

关于软考高级要不要报班学习

什么样的知识付费系统功能,更有利于平台与讲师发展?

Boss: there are too many systems in the company. Can we realize account interworking?

2021.07.13 我们是这样崩的

巧用ngx_lua做流量分组

Xiao Hei stands up again and looks at leetcode:653. Sum of two IV - enter BST
随机推荐
Include and require include_ Once and require_ Once difference
Read Plato farm's eplato and the reason for its high premium
什么样的知识付费系统功能,更有利于平台与讲师发展?
[ESP32][esp-idf] AP+STA实现无线桥接 中转wifi信号
排序——快速排序(快慢指针实现)
In retaliation for the dismissal of the company, I changed all code comments of the project!
Set of bus related concepts
What are the highlights of B2B2C system? How to help jewelry enterprises build an omni channel multi merchant mall management system
matlab特征点提取--记录自用
为报复公司解雇,我更改了项目的所有代码注释!
Redis设计规范
ELK实时日志分析平台
How to get more marks in the game under the new economic model of Plato farm
Qt | 信号和槽的一些总结
Install lamp under deepin
软件设计师考前20问,注意啦!!
不登高山,不知天之高也;不临深溪,不知地之厚也
银行入职考试要点汇总
双指针技巧
二分、三分、01分数规划 【第I弹】