@@ -8,11 +8,12 @@ local cjson = require("cjson.safe");
88local cache_api = require (" cache.tl_ops_cache_core" ):new (" tl-ops-balance-api" );
99local tl_ops_utils_func = require (" utils.tl_ops_utils_func" );
1010local tl_ops_constant_balance_api = require (" constant.tl_ops_constant_balance_api" );
11- local tl_ops_match_mode = require (" constant.tl_ops_constant_comm" ).tl_ops_match_mode ;
12- local tl_ops_constant_health = require (" constant.tl_ops_constant_health" )
13- local shared = ngx .shared .tlopsbalance
14- local find = ngx .re .find
15-
11+ local tl_ops_constant_comm = require (" constant.tl_ops_constant_comm" );
12+ local tl_ops_constant_health = require (" constant.tl_ops_constant_health" );
13+ local tl_ops_match_mode = tl_ops_constant_comm .tl_ops_match_mode ;
14+ local tl_ops_api_type = tl_ops_constant_comm .tl_ops_api_type ;
15+ local shared = ngx .shared .tlopsbalance ;
16+ local find = ngx .re .find ;
1617
1718-- 处理匹配逻辑
1819local tl_ops_balance_api_matcher_mode = function (matcher , request_uri , obj )
8182
8283
8384local tl_ops_balance_api_service_matcher = function (service_list_table )
85+
8486 local matcher = nil
8587 local node = nil
8688
@@ -153,15 +155,26 @@ local tl_ops_balance_api_service_matcher = function(service_list_table)
153155 local node_state , _ = shared :get (key )
154156
155157
158+ -- 静态页面代理路径
159+ local api_type = matcher .api_type
160+ if api_type and api_type == tl_ops_api_type .page then
161+ ngx .req .set_uri_args ({
162+ url = request_uri
163+ })
164+ ngx .req .set_uri (" /pageproxy" , true )
165+ return
166+ end
167+
156168 -- 需要重写url
157169 local rewrite_url = matcher .rewrite_url
158170 if rewrite_url and rewrite_url ~= ' ' then
159171 ngx .req .set_uri (rewrite_url , false )
172+ return
160173 end
161174
162- -- 需要转发到服务具体路径
175+ -- 需要转发到服务下的具体路径
163176 local fake_prefix = matcher .fake_prefix
164- if fake_prefix and matcher . fake_prefix ~= ' ' then
177+ if fake_prefix and fake_prefix ~= ' ' then
165178 -- 通过虚拟前缀截取后缀
166179 local fake_sub = string.sub (request_uri , # fake_prefix + 1 , # request_uri )
167180 if fake_sub then
0 commit comments