更新时间:2025-05-21 GMT+08:00
分享

SLB实例配置

本章介绍通过IaC进行SLB实例配置的管理,包括nginx.conf,url重写/重定向,内网段,降级,黑白名单,流控,其他配置以及自定义lua配置,对应的资源类型为WiseCloud::LoadBalancer::SLB::Config。

SLB实例配置

表1 SLB实例配置字段说明

参数名

是否必选

说明

instanceName

是

SLB实例名,长度<=50

globalConf

是

Nginx配置,长度<=16777215

urlResetConf

否

url重写重定向

innerSegmentsConf

是

内网段配置

degradeConf

否

降级配置

blackListConf

否

黑名单配置

vipListConf

否

白名单配置

flowControlConf

否

流控配置

confLuaConf

否

其他配置,不填采用默认值

customLuaConf

否

自定义lua配置,每个lua文件大小不得超过16KB。

样例:

- name: fgc-slb-config                             #必传,SLB配置实例名
  type: WiseCloud::LoadBalancer::SLB::Config       #资源类型为实例配置
  properties:
    instanceName: fgc-slb                          #必传,SLB实例名
    globalConf:                                    #必传,nginx配置
      $ref: 'slb_instance_config/nginx.conf'
    urlResetConf:                                  #非必传,url重写重定向配置
      $ref: 'slb_instance_config/url_reset_config.yaml#'
    innerSegmentsConf:                             #必传,内网段配置
      $ref: 'slb_instance_config/inner_segments_config.yaml#'
    degradeConf:                                   #非必传,降级配置
      $ref: 'slb_instance_config/degrade_config.yaml#'
    blackListConf:                                 #非必传,黑名单配置
      $ref: 'slb_instance_config/blacklist_config.yaml#'
    vipListConf:                                   #非必传,白名单配置
      $ref: 'slb_instance_config/viplist_config.yaml#'
    flowControlConf:                               #非必传,流控配置
      $ref: 'slb_instance_config/flow_control_config.yaml#'
    confLuaConf:                                   #非必传,其他配置
      $ref: 'slb_instance_config/conf_lua_config.yaml#'
    customLuaConf:                                 #非必传,自定义lua配置
      slb100GlobalInit: 
        $ref: 'slb_instance_config/SLB_100_Global_Init_iac3.lua'
      slb200WorkerInit:
        $ref: 'slb_instance_config/SLB_200_Worker_Init_iac3.lua'
      slb300PreFlowControl:
        $ref: 'slb_instance_config/SLB_300_Pre_FlowControl_iac3.lua'
      slb400OnFlowControled:
        $ref: 'slb_instance_config/SLB_400_On_FlowControled_iac3.lua'
      slb500PreGrey:
        $ref: 'slb_instance_config/SLB_500_Pre_Grey_iac3.lua'
      slb600PostGrey:
        $ref: 'slb_instance_config/SLB_600_Post_Grey_iac3.lua'
      slb700PostRoute:
        $ref: 'slb_instance_config/SLB_700_Post_Route_iac3.lua'
      slb750RespHeaderFilter:
        $ref: 'slb_instance_config/SLB_750_Resp_Header_Filter_iac3.lua'
      slb800RespBodyFilter:
        $ref: 'slb_instance_config/SLB_800_Resp_Body_Filter_iac3.lua'

nginx配置

slb_instance_config/nginx.conf #nginx默认配置

#user  slb slb;
worker_processes auto;
#worker_cpu_affinity 0001 0010 0100 1000;
pid        logs/nginx.pid;
#####################################################################
### Default: Close the error log
error_log  /dev/null crit;
# nofile per worker around 20000-100000 is ok, eg, if have 8 worker, nginx will use no more than 8*worker_rlimit_nofile nofile, should make this result less than system nofile.
worker_rlimit_nofile 51200;
events {
    use epoll;
    # connections per worker, usually setup same or similar value as worker_rlimit_nofile.
    worker_connections 51200;
}
http {
    #####################################################################
    ### load basic lua script
    include 'lua/nginx.http.lua.conf';
    init_by_lua_file 'conf/lua/initial.lua';
    init_worker_by_lua_file 'conf/lua/initialWorker.lua';
    log_by_lua_file 'conf/lua/monitor/LogRequest.lua';
    #rewrite_by_lua_no_postpone on;
    #####################################################################
    uninitialized_variable_warn off;
    server_tokens off;
    autoindex off;
    port_in_redirect off;
    ssi off;
    proxy_hide_header X-Powered-By;
    add_header X-XSS-Protection "1; mode=block";
    add_header X-frame-options SAMEORIGIN;
    add_header X-Content-Type-Options  nosniff;
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains ";
    add_header Content-Security-Policy "default-src 'self'";
    add_header Cache-control "no-cache, no-store, must-revalidate";
    add_header Pragma no-cache;
    add_header Expires 0;
    client_header_timeout 60s;
    client_body_timeout 60s;
    keepalive_timeout 75s;
    send_timeout 60s;
    client_header_buffer_size 1k;
    large_client_header_buffers 4 8k;
    client_body_buffer_size 16k;
    client_max_body_size 1m;
    proxy_buffer_size 8k;
    proxy_buffers 8 8k;
    proxy_busy_buffers_size 16k;
    include mime.types;
    default_type text/html;
    #####################################################################
    ### gzip compress
    gzip on;
    gzip_http_version 1.1;
    gzip_comp_level 5;
    gzip_min_length 1k;
    gzip_disable "MSIE [1-6].";
    gzip_types
        text/plain text/css text/xml text/javascript
        application/json application/x-javascript application/xml application/xml+rss application/xhtml+xml;
    #####################################################################
    ### enabled the error page  process
    fastcgi_intercept_errors on;
    error_page 400 401 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 /4xx.html;
    error_page 500 501 502 503 504 505 /5xx.html;
    #####################################################################
    ### log format and switch.
    log_format  main  '$time_local|$request_time|$upstream_response_time|$uri'
        '|$status|$body_bytes_sent|$request_length|$bytes_sent|$http_user_agent|$http_host'
        '|$upstream_addr|$upstream_status|$scheme|$is_grey_server|$resp_status|$server_protocol';
    access_log logs/access.log  main buffer=5m flush=10s;
    log_format  bigData  '$time_local|$server_addr|$upstream_addr|$is_grey_server|$uri'
        '|$upstream_status|$resp_status|$request_time|$upstream_response_time|$request_length|$bytes_sent|$connections_active|$target_all|$remote_addr'
        '|$http_x_forwarded_for|$request_method|$http_user_agent|$status|$http_referer|$server_protocol|$body_bytes_sent|$request_length|$http_host|$request'
        '|$server_port|-|$http_x_api_method||||||||||';
    access_log logs/access_for_big_data.log  bigData buffer=5m flush=10s;
    #####################################################################
    ### load sub configure
    include vhosts/*.conf;
    include slb_conf/*.conf;
}

重写重定向配置

表2 urlResetConf字段说明

参数名

类型

是否必选

说明

transferType

String

是

转换类型,为以下枚举值:

  • rewriteGrey:灰度重写
  • rewriteNormal:生产重写
  • redirectGrey:灰度重定向
  • redirectNormal:生产重定向

source

String

是

匹配路径,例:/abc/portal/login.jsp(.*)$

target

String

是

目标路径,例:/abc/def/$1

slb_instance_config/url_reset_config.yaml #重写重定向配置

- transferType: rewriteNormal               #必填,转发类型,rewriteNormal代表生产重写
  source: /a1                               #必填,匹配路径
  target: /b1                               #必填,目标路径
- transferType: rewriteGrey                 #必填,转发类型,rewriteGrey代表灰度重写
  source: /a2                               #必填,匹配路径
  target: /b2                               #必填,目标路径

内网段配置

表3 innerSegmentsConf字段说明

参数名

类型

是否必选

说明

segment

String

是

IP地址段,格式为ip/子网掩码。

slb_instance_config/inner_segments_config.yaml #内网段配置

- segment: 10.0.0.0/8               
- segment: 127.0.0.1/32
- segment: 172.16.0.0/12
- segment: 192.168.0.0/16
- segment: 100.125.0.0/16

降级配置

表4 degradeConf

参数名

类型

是否必选

说明

switchStatus

String

是

降级开关,取值为on或off。

degradeUrl

String

否

修改时必传,不传表示置空此项,取值<=500。

currentLevel

int

是

当前降级等级,取值为整数1到5。

defaultLevel

int

是

接口默认等级,取值为整数1到5。

ruleItems

List<DegradeRule>

当降级开关为on时必填

当降级开关为off时非必填

降级列表,每个等级只能有一个。

表5 DegradeRule

参数名

类型

是否必选

说明

level

String

是

降级等级,取值为1-5之间。

values

int

是

降级规则,对应等级的匹配规则表达式,例如:

path equal[/abc/def,abc/ghi]

<=100000

slb_instance_config/degrade_config.yaml #降级配置

switchStatus: 'on'                           #必填,降级开关,取值为off或on
defaultLevel: 4                              #必填,接口默认等级,取值为整数1到5
currentLevel: 3                              #必填,当前降级等级,取值为整数1到5
degradeUrl: @xxx                             #非必填,降级url
ruleItems:                                   #降级规则信息
  - level: 1                                 #必填,等级
    values: head[appid] equal[1,2,3]         #必填,降级规则
  - level: 2
    values: head[appid] equal[4,5,6]

黑白名单配置

表6 blackListConf/vipListConf字段说明

参数名

类型

是否必选

说明

switchStatus

String

是

开关,取值为on或off。

groups

List<BlackVipListGroup>

是

名单列表

degradeUrl

String

否

定制响应location,以@olc_degrade开头,当不传递时,表示置空该字段。

表7 BlackVipListGroup

参数名

类型

是否必选

说明

ruleItems

List<BlackVipListRule>

是

规则列表

表8 BlackVipListRule

参数名

类型

是否必选

说明

type

String

是

匹配项类型,取值为:path、left-ip、right-ip、custom。

param

String

否

参数名,长度<=50

Type为custom时必传,其他type无需传递。

position

String

否

位置

  • Type为custom时必传,为以下枚举值:queryString、header、resource、body-json、body-form。
  • 当type为path、left-ip、right-ip时无需传递。

match

String

是

匹配条件

  • 当type为left-ip或right-ip时,仅支持:sha256和rangeIP。
  • 当type为custom或path时,仅支持:equal、sha256、pattern。

values

String

是

对应匹配的值

  • match为equal时,例如填写1,2,3,表示1或2或3都可匹配。
  • 当match为rangeIP时,填写样例:

    10.1.1.1-10.1.1.100,10.2.2.1-10.2.2.100

  • match为sha256时,填写样例:5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5, 226fe7d26af82de76db083e6a29524ca68f4aaf80f2c2db058571fdb8f1fdeea
  • match为pattern时,填写样例:

    ^abc

    <=102400

slb_instance_config/blacklist_config.yaml #黑名单配置

switchStatus: 'on'                                 #必填,黑名单开关,取值为off或on
degradeUrl: @xxx                                   #非必填,降级url
groups:                                            #必填,黑名单组
  - ruleItems:                                     #必填,组内规则
    - type: custom                                 #必填,类型
      param: x-app-id                              #非必填,参数
      position: header                             #非必填,位置
      match: equal                                 #必填,匹配条件
      values: '[1,2,3]'                            #必填,值

slb_instance_config/viplist_config.yaml #白名单配置

switchStatus: 'on'                                     #必填,白名单开关,取值为off或on
groups:                                                #必填,白名单列表
  - ruleItems:                                         #必填,组内规则
    - type: custom                                     #必填,类型
      param: x-app-id                                  #非必填,参数
      position: header                                 #非必填,位置
      match: equal                                     #必填,匹配条件
      values: '[1,2,3]'                                #必填,值

流控配置

表9 flowControlConf字段说明

参数名

类型

是否必选

说明

flowControlSwitch

String

是

流控总开关,取值为on或off。

autoDivideSwitch

String

是

分摊模式开关,取值为on或off。

flowControlOrder

String

是

流控类型执行顺序,和下面的流控配置相匹配。

nodeFlowControl

FlowControlTypeBean

否

节点级流控配置

interfaceFlowControl

FlowControlTypeBean

否

接口级流控配置

serviceFlowControl

FlowControlTypeBean

否

服务级流控配置

ipFlowControl

FlowControlTypeBean

否

IP流控配置

singleParamFlowControl

FlowControlTypeBean

否

自定义参数流控配置

multiParamFlowControl

FlowControlTypeBean

否

多参数组合流控配置

quotaFlowControl

FlowControlTypeBean

否

配额流控配置

concurrentFlowControl

FlowControlTypeBean

否

并发连接流控配置

表10 FlowControlTypeBean

参数名

类型

是否必选

说明

switchStatus

String

是

流控开关,取值为on或off

degradeUrl

String

是

降级URL,长度<500

limit

int

是

每秒请求量

burst

int

是

突发请求量

limitTag

String

否

自定义标签,长度<=200

ruleItems

List<FlowControlRule>

否

匹配规则列表

configGroups

List<FlowControlGroup>

否

匹配规则组列表

表11 FlowControlRule

参数名

类型

是否必选

说明

type

String

否

匹配项类型,为以下枚举:path、left-ip、right-ip、custom。

param

String

否

参数名,长度<50。

type为custom时必传,其他type无需传递。

position

String

否

位置

  • type为custom时必传,以下枚举值:queryString、header、resource、body-json、body-form、url。
  • 其他type无需传递。

match

String

是

参数匹配方式

  • 当type为left-ip或right-ip时,仅支持:sha256和rangeIP。
  • 当type为custom或path时,仅支持:equal、sha256、pattern。

values

String

是

对应匹配的值

  • match为equal时,例如填写1,2,3,表示1或2或3都可匹配。
  • 当match为rangeIP时,填写样例:

    10.1.1.1-10.1.1.100,10.2.2.1-10.2.2.100

  • match为sha256时,填写样例:5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5, 226fe7d26af82de76db083e6a29524ca68f4aaf80f2c2db058571fdb8f1fdeea
  • match为pattern时,填写样例:

    ^abc

    <=102400

isAgg

String

否

是否聚合,0不聚合 1 聚合,默认不聚合

limit

int

否

limit大小

接口级流控,ip流控,服务级流控,单参数流控必填,其他类型流控无效

burst

int

否

突发量

接口级流控,ip流控,服务级流控,单参数流控必填,其他类型流控无效

limitTag

String

否

自定义标签

<=200

表12 FlowControlGroup

参数名

类型

是否必选

说明

timeWindow

int

否

配额周期,正整数。

timeWindow配合timeUnit,最多不超过86400秒,或不超过1440分钟,或不超过24小时,或不超过1天。

timeUnit

String

否

时间单位,取值为second、minute、hour、day。

limit

int

是

限流数量。

burst

int

否

突发量。

ruleItems

List< FlowControlRuleBean >

是

匹配规则列表。

slb_instance_config/flow_control_config.yaml #流控配置

flowControlSwitch: 'on'                            #必填,流控总开关,取值为off或on
autoDivideSwitch: 'off'                            #必填,分摊模式开关,取值为off或on
flowControlOrder: nodeFlowControl,urlFlowControl   #必填,流控类型顺序;和下面的流控配置相匹配
nodeFlowControl:                                   #非必填,节点级流控
  switchStatus: 'on'                               #必填,节点级流控开关,取值为off或on
  degradeUrl: xxx                                  #非必填,限流降级url
  limit: 1000                                      #必填,流控值
  burst: 1000                                      #必填,突发量
  limitTag: xxxx                                   #非必填,自定义标签
serviceFlowControl:                                #非必填,服务级流控
  switchStatus: 'on'
  degradeUrl: xxx
  limit: 1000
  burst: 1000
  ruleItems:                                       #必填,流控规则
    - match: equal                                 #必填,匹配条件;取值有equal,pattern
      values: example.com                          #必填,域名值
      limit: 1000                                  #必填,流控值
      burst: 1000                                  #必填,突发量
      limitTag: xxxx                               #非必填,自定义标签
interfaceFlowControl:                              #非必填,接口级流控
  switchStatus: 'on'
  degradeUrl: xxx
  limit: 1000
  burst: 1000
  ruleItems:
    - match: equal                                 #必填,匹配条件;取值有equal,pattern
      values: xxx                                  #必填,接口url
      limit: 1000                                  #必填,流控值
      burst: 1000                                  #必填,突发量
      limitTag: xxxx                               #非必填,自定义标签
      isAgg: off                                   #非必填,聚合统计开关
ipFlowControl:                                     #非必填,IP流控
  switchStatus: 'on'
  degradeUrl: xxx
  limit: 1000
  burst: 1000
  ruleItems:
    - type: left-ip                                #必填,类型
      match: rangeIP                               #必填,匹配条件
      values: 1.1.1.1-1.1.1.2                      #必填,值
      limit: 1000                                  #必填,流控值
      burst: 1000                                  #必填,突发量
      limitTag: xxxx                               #非必填,自定义标签
singleParamFlowControl:                            #非必填,自定义参数流控
  switchStatus: 'on'
  degradeUrl: xxx
  ruleItems:
    - param: xxx                                   #必填,参数
      position: url                                #必填,位置
      match: equal                                 #必填,匹配条件
      values: 1                                    #必填,值
      limit: 1000                                  #必填,流控值
      burst: 1000                                  #必填,突发量
      limitTag: xxxx                               #非必填,自定义标签
multiParamFlowControl:                             #非必填,多参数组合流控 
  switchStatus: 'on'
  degradeUrl: xxx
  configGroups:                                    #必填,配置组
    - limit: 1000                                  #必填,组流控值
      burst: 1000                                  #必填,组突发量
      limitTag: xxxx                               #非必填,自定义标签
      ruleItems:                                   #必填,流控规则
        - type: path                               #必填,类型
          param:                                   #非必填,参数
          position:                                #非必填,位置
          match: equal                             #必填,匹配条件
          values: /a                               #必填,值
          isAgg: 'off'                             #非必填,聚合统计开关
        - type: custom
          param: zzz
          position: queryString
          match: equal
          values: 1
          isAgg: off
quotaFlowControl:                                 #非必填,配额流控
  switchStatus: 'on'
  degradeUrl: @example.com
  configGroups:                                   #必填,配置组
    - timeWindow: 10                              #必填,时间周期窗口
      timeUnit: minute                            #必填,时间单位
      limit: 1000                                 #必填,配额大小
      limitTag: xxxx                              #非必填,自定义标签
      ruleItems:                                  #必填,流控规则
        - type: path                              #必填,类型
          param:                                  #非必填,参数
          position:                               #非必填,位置 
          match: equal                            #必填,匹配条件
          values: /a                              #必填,值
          isAgg: 'off'                            #非必填,聚合统计开关
        - type: custom
          param: zzz
          position: queryString
          match: equal
          values: 1
          isAgg: off
concurrentFlowControl:                           #非必填,并发连接流控 
  switchStatus: 'on'
  degradeUrl: xxx
  configGroups:                                  #必填,配置组
    - limit: 1000                                #必填,流控值
      burst: 1000                                #必填,突发量
      limitTag: xxxx                             #非必填,自定义标签
      ruleItems:                                 #必填,流控规则
        - type: path                             #必填,类型
          param:                                 #非必填,参数
          position:                              #非必填,位置
          match: equal                           #必填,匹配条件
          values: /a                             #必填,值
        - type: custom
          param: zzz
          position: queryString
          match: equal
          values: 1

其他配置

表13 confLuaConf字段说明

参数名

说明

addGreyFlag

灰度标记开关,取值为on或off。

greyTestSwitch

灰度测试开关,取值为on或off。

greyTestServiceId

灰度测试服务Id。

greyTestSwitch为on时必传。

getIpType

取IP方式,取值为1或2,1表示从左取,2表示从右取,默认为1。

isBypassOnGreyDown

灰度服务器全部宕机后,请求路由到生产开关,取值为on或off,默认为off。

areaGreyGetIpFromLeft

地域灰度IP从左侧取值开关,取值为on或off,默认为off。

greyTestQpsLimit

灰度测试每秒转发量限制,取值为1到1000。

successRateAlarmAbsThreshold

成功率告警阈值绝对值,非负浮点数,取值为0到100,默认值为90。

successRateAlarmOffsetThreshold

成功率下降告警阈值(相比1分钟前或者5分钟前),非负浮点数,取值为0到100,默认值为5。

healthCheckAlarmServerCountThreshold

健康检查不健康机器数告警阈值,正整数,默认为1,表示有1台节点不健康就会告警。

healthCheckAlarmDurationThreshold

健康检查告警持续时间阈值,非负正整数,默认为0,表示不健康主机立即告警;如果配置为1,表示发现不健康持续1分钟以上,才会告警。

concurrentFlowControlAlarmThreshold

并发请求流控告警阈值,非负整数,默认为0,表示只要发生1次流控,就会告警。

serviceFlowControlAlarmThreshold

服务级流控告警阈值,非负整数,默认0,表示只要发生1次流控,就会告警。

singleParamFlowControlAlarmThreshold

自定义参数流控告警阈值,非负整数,默认0,表示只要发生1次流控,就会告警。

multiParamFlowControlAlarmThreshold

多参数流控告警阈值,非负整数,默认0,表示只要发生1次流控,就会告警。

quotaFlowControlAlarmThreshold

配额流控告警阈值,非负整数,默认0,表示只要发生1次流控,就会告警。

manyRequestPreAlarmThreshold

请求数过多告警阈值,正整数,例如:25000,表示每个cpu每分钟平均处理达到25000请求,则触发告警。

以4C的主机为例,1分钟处理超过25000*4=100000请求,则开始告警。

manyRequestAlarmThreshold

请求数警阈值,非负整数,默认为0。

statisticsParams

统计日志参数,格式为ParamName:position。

  • ParamName为参数名称。
  • Position为参数位置,取值为queryString或header。

slb_instance_config/conf_lua_config.yaml #其他配置

addGreyFlag: 'off'                                          #非必填,灰度标记开关,取值为off或on
greyTestSwitch: 'off'                                       #非必填,灰度测试开关,取值为off或on
greyTestServiceId: 123456                                   #非必填,灰度测试服务ID
isBypassOnGreyDown: 'off'                                   #非必填,宕机时路由到生产集群开关,取值为off或on
areaGreyGetIpFromLeft: 'off'                                #非必填,地域灰度IP从左取值开关 ,取值为off或on
getIpType: 1                                                #非必填,取IP方式,取值为1或2
statisticsParams:                                           #非必填,统计日志参数
greyTestQpsLimit: 1000                                     #非必填,灰度测试每秒转发量限制,取值为1到1000
manyRequestAlarmThreshold: 1000                             #非必填,请求数量告警 
successRateAlarmAbsThreshold: 90                            #非必填,成功率告警阈值,取值为0到100
successRateAlarmOffsetThreshold: 90                         #非必填,成功率下降告警阈值,取值为0到100
healthCheckAlarmServerCountThreshold: 1000                  #非必填,健康检查告警阈值
healthCheckAlarmDurationThreshold: 1000                     #非必填,健康告警持续时间阈值
concurrentFlowControlAlarmThreshold: 1000                   #非必填,并发连接流控告警阈值
serviceFlowControlAlarmThreshold: 1000                      #非必填,服务级流控告警阈值
multiParamFlowControlAlarmThreshold: 1000                   #非必填,多参数流控告警阈值
singleParamFlowControlAlarmThreshold: 1000                  #非必填,自定义参数流控告警阈值
quotaFlowControlAlarmThreshold: 1000                        #非必填,配额流控告警阈值
manyRequestPreAlarmThreshold: 1000                          #非必填,请求数量预告警

自定义lua配置

表14 customLuaConf字段说明

参数名

类型

是否必选

说明

slb100GlobalInit

String

否

大小不得超过16KB

slb200WorkerInit

String

否

大小不得超过16KB

slb300PreFlowControl

String

否

大小不得超过16KB

slb400OnFlowControled

String

否

大小不得超过16KB

slb500PreGrey

Int

否

大小不得超过16KB

slb600PostGrey

String

否

大小不得超过16KB

slb700PostRoute

String

否

大小不得超过16KB

slb750RespHeaderFilter

int

否

大小不得超过16KB

slb800RespBodyFilter

float

否

大小不得超过16KB

slb_instance_config/SLB_100_Global_Init_iac3.lua #SLB_100_Global_Init_iac3.lua默认配置

--the custom point SLB_100_Global_Init, running when Global init.
--will be triggered in exec function, so pls make sure there is a exec function in global_init
local global_init = {};
function global_init.exec(gen_param)
    --eg:ngx.log(ngx.ERR,"i am in global_init")
end
return global_init

slb_instance_config/SLB_200_Worker_Init_iac3.lua #SLB_200_Worker_Init_iac3.lua默认配置

--the custom point SLB_200_Worker_Init, running when Worker init.
--will be triggered in exec function, so pls make sure there is a exec function in worker_init
local worker_init = {};
function worker_init.exec(gen_param)
    --eg:ngx.log(ngx.ERR,"i am in worker init");
end
return worker_init

slb_instance_config/SLB_300_Pre_FlowControl_iac3.lua #SLB_300_Pre_FlowControl_iac3.lua默认配置

--the custom point SLB_300_Pre_FlowControl, running before flowcontrol and blacklist.
--will be triggered in exec function, so pls make sure there is a exec function in pre_flowcontrol
local pre_flowcontrol = {};
function pre_flowcontrol.exec(gen_param)
    --eg:ngx.log(ngx.ERR,"I am in pre flowcontrol")
end
return pre_flowcontrol

slb_instance_config/SLB_400_On_FlowControled_iac3.lua #SLB_400_On_FlowControled_iac3.lua默认配置

--the custom point SLB_400_On_FlowControlled, running when request is flowcontrolled or blocked due to blacklist.
--will be triggered in exec function, so pls make sure there is a exec function in on_flowcontroled
local on_flowcontroled = {};
function on_flowcontroled.exec(gen_param)
    --eg:ngx.log(ngx.ERR,"the flowcontrol type is:",gen_param.control_type)
end
return on_flowcontroled

slb_instance_config/SLB_500_Pre_Grey_iac3.lua #SLB_500_Pre_Grey_iac3.lua默认配置

--the custom point SLB_500_Pre_Grey, running before Greyrule judge.
--will be triggered in exec function, so pls make sure there is a exec function in pre_grey
local pre_grey = {};
function pre_grey.exec(gen_param)
    --eg:ngx.log(ngx.ERR,"I am in pre grey");
end
return pre_grey

slb_instance_config/SLB_600_Post_Grey_iac3.lua #SLB_600_Post_Grey_iac3.lua默认配置

--the custom point SLB_600_Post_Grey, running after get result of greyrule.
--will be triggered in exec function, so pls make sure there is a exec function in post_grey
local post_grey = {};
function post_grey.exec(gen_param)
    --eg:ngx.log(ngx.ERR,"I AM IN POST GREY");
end
return post_grey

slb_instance_config/SLB_700_Post_Route_iac3.lua #SLB_700_Post_Route_iac3.lua默认配置

--the custom point SLB_700_Post_Route, running after get result of routerule.
--will be triggered in exec function, so pls make sure there is a exec function in post_route
local post_route = {};
function post_route.exec(gen_param)
    --eg:ngx.log(ngx.ERR,"I AM IN POST Route");
end
return post_route

slb_instance_config/SLB_750_Resp_Header_Filter_iac3.lua #SLB_750_Resp_Header_Filter_iac3.lua默认配置

--the custom point SLB_750_Resp_Header_Filter, running during header filter.
--will be triggered in exec function, so pls make sure there is a exec function in header_filter
local header_filter = {};
function header_filter.exec(gen_param)
    --eg:ngx.log(ngx.ERR,"I am in header filter");
end
return header_filter

slb_instance_config/SLB_800_Resp_Body_Filter_iac3.lua #SLB_800_Resp_Body_Filter_iac3.lua默认配置

--the custom point SLB_800_Resp_Body_Filter, running during body filter.
--will be triggered in exec function, so pls make sure there is a exec function in body_filter
local body_filter = {};
function body_filter.exec(gen_param)
    --eg:ngx.log(ngx.ERR,"I am in body filter");
end
return body_filter

相关文档