Path: API › Proxy 反向代理

`POST /mod/proxy/com/{action}/stype`

管理反向代理的内容替换（sub_filter）规则，用于在代理响应中替换文本。

## Path parameters

- `action` (`action225.path.action`; string, required) — 具体操作名称，参见下方原始接口文档。

## Request body

_Required._

- `request_time` (`action225.request_time`; string, required) — Unix 时间戳。
- `request_token` (`action225.request_token`; string, required) — 按 API 概览生成的签名。
- `site_name` (`action225.site_name`; string, required) — 站点名称
- `proxy_path` (`action225.proxy_path`; string, required) — 代理路径，如 `/`
- `oldstr` (`action225.oldstr`; string, required) — 被替换的字符串
- `newstr` (`action225.newstr`; string, required) — 替换后的字符串
- `sub_type` (`action225.sub_type`; string, optional) — 替换类型，由 `g`(全局), `i`(忽略大小写), `o`(只匹配一次), `r`(正则) 组合。注意 `g` 和 `o` 不能同时存在

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "site_name": "string",
  "proxy_path": "string",
  "oldstr": "string",
  "newstr": "string",
  "sub_type": "string"
}
```

## Code samples

### cURL（填写面板地址与签名）

```bash
curl --request POST \
  --url "https://your-panel.example.com:8888/mod/proxy/com/<action>/stype" \
  --header "Content-Type: application/x-www-form-urlencoded" \
  --data-urlencode "request_time=<Unix时间戳>" \
  --data-urlencode "request_token=<按 API 概览生成的签名>" \
  --data-urlencode "site_name=<site_name>" \
  --data-urlencode "proxy_path=<proxy_path>" \
  --data-urlencode "oldstr=<oldstr>" \
  --data-urlencode "newstr=<newstr>"
```

## Responses

### default

接口响应，业务状态见下方详细说明。

#### Example

```json
{
  "code": 0,
  "status": true,
  "msg": "设置成功！"
}
```


## add_sub_filter / del_sub_filter

管理反向代理的内容替换（sub_filter）规则，用于在代理响应中替换文本。

- **路由**：`POST /mod/proxy/com/{action}/stype`

## add_sub_filter — 添加内容替换

### 输入参数
| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| site_name | 是 | string | 站点名称 |
| proxy_path | 是 | string | 代理路径，如 `/` |
| oldstr | 是 | string | 被替换的字符串 |
| newstr | 是 | string | 替换后的字符串 |
| sub_type | 否 | string | 替换类型，由 `g`(全局), `i`(忽略大小写), `o`(只匹配一次), `r`(正则) 组合。注意 `g` 和 `o` 不能同时存在 |

## del_sub_filter — 删除内容替换

### 输入参数
| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| site_name | 是 | string | 站点名称 |
| proxy_path | 是 | string | 代理路径 |
| oldstr | 是 | string | 被替换的字符串（需与添加时一致） |
| newstr | 是 | string | 替换后的字符串（需与添加时一致） |

## 示例

### add_sub_filter 请求
```bash
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 请求
```bash
curl -X POST ".../mod/proxy/com/del_sub_filter/stype" \
  -d "site_name=example.com&proxy_path=/&oldstr=http://&newstr=https://"
```

### 响应
```json
{"code": 0, "status": true, "msg": "设置成功！"}
```

