@@ -39,12 +39,12 @@ function _M:tl_ops_balance_core_filter(ctx)
3939 -- 服务节点配置列表
4040 local service_list_str , _ = cache_service :get (tl_ops_constant_service .cache_key .service_list );
4141 if not service_list_str then
42- tl_ops_err_content :err_content_rewrite_to_balance (" " , " empty" , " " , tl_ops_constant_balance .cache_key .service_empty )
42+ tl_ops_err_content :err_content_rewrite_to_balance (" " , " empty" , " " , tl_ops_constant_balance .cache_key .service_empty , " " )
4343 return
4444 end
4545 local service_list_table = cjson .decode (service_list_str );
4646 if not service_list_table and type (service_list_table ) ~= ' table' then
47- tl_ops_err_content :err_content_rewrite_to_balance (" " , " empty" , " " , tl_ops_constant_balance .cache_key .service_empty )
47+ tl_ops_err_content :err_content_rewrite_to_balance (" " , " empty" , " " , tl_ops_constant_balance .cache_key .service_empty , " " )
4848 return
4949 end
5050
@@ -75,7 +75,7 @@ function _M:tl_ops_balance_core_filter(ctx)
7575 node , node_state , node_id , host , rule_match_mode = tl_ops_balance_core_body .tl_ops_balance_body_service_matcher (service_list_table )
7676 if not node then
7777 -- 无匹配
78- tl_ops_err_content :err_content_rewrite_to_balance (" " , " empty" , balance_mode , tl_ops_constant_balance .cache_key .mode_empty )
78+ tl_ops_err_content :err_content_rewrite_to_balance (" " , " empty" , balance_mode , tl_ops_constant_balance .cache_key .mode_empty , " " )
7979 return
8080 end
8181 end
@@ -86,13 +86,13 @@ function _M:tl_ops_balance_core_filter(ctx)
8686 if rule_match_mode and rule_match_mode == api_match_mode .api then
8787 -- 域名负载
8888 if host == nil or host == ' ' then
89- tl_ops_err_content :err_content_rewrite_to_balance (" " , " nil" , balance_mode , tl_ops_constant_balance .cache_key .host_empty )
89+ tl_ops_err_content :err_content_rewrite_to_balance (" " , " nil" , balance_mode , tl_ops_constant_balance .cache_key .host_empty , " " )
9090 return
9191 end
9292
9393 -- 域名匹配
9494 if host ~= " *" and host ~= ngx .var .host then
95- tl_ops_err_content :err_content_rewrite_to_balance (" " , " pass" , balance_mode , tl_ops_constant_balance .cache_key .host_pass )
95+ tl_ops_err_content :err_content_rewrite_to_balance (" " , " pass" , balance_mode , tl_ops_constant_balance .cache_key .host_pass , " " )
9696 return
9797 end
9898 end
@@ -106,7 +106,7 @@ function _M:tl_ops_balance_core_filter(ctx)
106106 local token_result = tl_ops_limit_fuse_token_bucket .tl_ops_limit_token ( node .service , node_id )
107107 if not token_result or token_result == false then
108108 balance_count :tl_ops_balance_count_incr_fail (node .service , node_id )
109- tl_ops_err_content :err_content_rewrite_to_balance (" " , " t-limit" , balance_mode , tl_ops_constant_balance .cache_key .token_limit )
109+ tl_ops_err_content :err_content_rewrite_to_balance (" " , " t-limit" , balance_mode , tl_ops_constant_balance .cache_key .token_limit , " " )
110110 return
111111 end
112112 end
@@ -116,7 +116,7 @@ function _M:tl_ops_balance_core_filter(ctx)
116116 local leak_result = tl_ops_limit_fuse_leak_bucket .tl_ops_limit_leak ( node .service , node_id )
117117 if not leak_result or leak_result == false then
118118 balance_count :tl_ops_balance_count_incr_fail (node .service , node_id )
119- tl_ops_err_content :err_content_rewrite_to_balance (" " , " l-limit" , balance_mode , tl_ops_constant_balance .cache_key .leak_limit )
119+ tl_ops_err_content :err_content_rewrite_to_balance (" " , " l-limit" , balance_mode , tl_ops_constant_balance .cache_key .leak_limit , " " )
120120 return
121121 end
122122 end
@@ -137,7 +137,7 @@ function _M:tl_ops_balance_core_filter(ctx)
137137 end
138138 shared :incr (limit_req_fail_count_key , 1 )
139139
140- tl_ops_err_content :err_content_rewrite_to_balance (node .service .. " :" .. node .name , " offline" , balance_mode , tl_ops_constant_balance .cache_key .offline )
140+ tl_ops_err_content :err_content_rewrite_to_balance (node .service .. " :" .. node .name , " offline" , balance_mode , tl_ops_constant_balance .cache_key .offline , " " )
141141 return
142142 end
143143
@@ -155,6 +155,7 @@ function _M:tl_ops_balance_core_balance(ctx)
155155 local tlops_ups_mode = ctx .tlops_ups_mode
156156 local tlops_ups_node = ctx .tlops_ups_node
157157 local tlops_ups_node_id = ctx .tlops_ups_node_id
158+ local tlops_ups_api_prefix = ngx .var .tlops_ups_api_prefix ;
158159
159160 if not tlops_ups_mode or not tlops_ups_node or not tlops_ups_node_id then
160161 return
@@ -173,7 +174,8 @@ function _M:tl_ops_balance_core_balance(ctx)
173174 ngx .header [tl_ops_constant_balance .proxy_server ] = tlops_ups_node .service .. " :" .. tlops_ups_node .name ;
174175 ngx .header [tl_ops_constant_balance .proxy_state ] = " online"
175176 ngx .header [tl_ops_constant_balance .proxy_mode ] = tlops_ups_mode
176-
177+ ngx .header [tl_ops_constant_balance .proxy_prefix ] = tlops_ups_api_prefix
178+
177179 local ok , err = ngx_balancer .set_current_peer (tlops_ups_node .ip , tlops_ups_node .port )
178180 if ok then
179181 ngx_balancer .set_timeouts (3 , 60 , 60 )
0 commit comments