File tree 2 files changed +15
-0
lines changed 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 13
13
include generic_conf/basic_vts_setup.conf;
14
14
include generic_conf/setup_cache.conf;
15
15
16
+
16
17
init_by_lua_block {
17
18
loadbalancer = require "loadbalancer"
18
19
loadbalancer.setup_server_list()
@@ -28,9 +29,23 @@ http {
28
29
29
30
server {
30
31
listen 8080 ;
32
+ vhost_traffic_status_filter_by_set_key $different_status different_status::*;
33
+ set_by_lua_block $different_status {return "" }
31
34
32
35
location / {
33
36
access_by_lua_block {
37
+ local rand = math.random(0,100)
38
+
39
+ if rand < 50 then
40
+ ngx.var.different_status = "less_50"
41
+ elseif rand < 90 then
42
+ ngx.var.different_status = "less_90"
43
+ elseif rand < 95 then
44
+ ngx.var.different_status = "less_95"
45
+ else
46
+ ngx.var.different_status = "more_95"
47
+ end
48
+
34
49
loadbalancer.resolve_name_for_upstream()
35
50
}
36
51
You can’t perform that action at this time.
0 commit comments