跳到主要内容
版本:latest

add_sub_filter / del_sub_filter

管理反向代理的内容替换(sub_filter)规则,用于在代理响应中替换文本。

  • 路由POST /mod/proxy/com/{action}/stype

add_sub_filter — 添加内容替换

输入参数

参数名称必选类型描述
site_namestring站点名称
proxy_pathstring代理路径,如 /
oldstrstring被替换的字符串
newstrstring替换后的字符串
sub_typestring替换类型,由 g(全局), i(忽略大小写), o(只匹配一次), r(正则) 组合。注意 go 不能同时存在

del_sub_filter — 删除内容替换

输入参数

参数名称必选类型描述
site_namestring站点名称
proxy_pathstring代理路径
oldstrstring被替换的字符串(需与添加时一致)
newstrstring替换后的字符串(需与添加时一致)

示例

add_sub_filter 请求

curl -X POST ".../mod/proxy/com/add_sub_filter/stype" \
-d "site_name=example.com&proxy_path=/&oldstr=http://&newstr=https://&sub_type=ig"

del_sub_filter 请求

curl -X POST ".../mod/proxy/com/del_sub_filter/stype" \
-d "site_name=example.com&proxy_path=/&oldstr=http://&newstr=https://"

响应

{"code": 0, "status": true, "msg": "设置成功!"}