Path: API › Proxy 反向代理

`POST /mod/proxy/com/create/stype`

创建反向代理站点，生成 Nginx 配置文件、写入数据库、添加防火墙规则。

## Request body

_Required._

- `request_time` (`action211.request_time`; string, required) — Unix 时间戳。
- `request_token` (`action211.request_token`; string, required) — 按 API 概览生成的签名。
- `domains` (`action211.domains`; string, required) — 域名列表，多个用换行符分隔，可带端口如 `example.com:8080`
- `proxy_pass` (`action211.proxy_pass`; string, required) — 代理目标 URL，`http://` 或 `https://` 开头
- `action` (`action211.action`; string, required) — 具体操作名称。
  - one of `"create"`
- `proxy_path` (`action211.proxy_path`; string, optional) — 代理路径，默认 `/`
- `proxy_host` (`action211.proxy_host`; string, optional) — 代理 Host 头，默认 `$http_host`
- `proxy_type` (`action211.proxy_type`; string, optional) — 代理类型，`http`（默认）或 `unix`
- `remark` (`action211.remark`; string, optional) — 备注

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "domains": "string",
  "proxy_path": "string",
  "proxy_pass": "string",
  "proxy_host": "string",
  "proxy_type": "string",
  "remark": "string",
  "action": "create"
}
```

## Code samples

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

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

## Responses

### default

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

#### Example

```json
{
  "status": true,
  "msg": "反向代理项目添加成功！"
}
```

- `status` (`action211.response.default.status`; boolean, optional) — 操作结果
- `msg` (`action211.response.default.msg`; string, optional) — 提示信息


## create

创建反向代理站点，生成 Nginx 配置文件、写入数据库、添加防火墙规则。

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

## 输入参数
| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| domains | 是 | string | 域名列表，多个用换行符分隔，可带端口如 `example.com:8080` |
| proxy_path | 否 | string | 代理路径，默认 `/` |
| proxy_pass | 是 | string | 代理目标 URL，`http://` 或 `https://` 开头 |
| proxy_host | 否 | string | 代理 Host 头，默认 `$http_host` |
| proxy_type | 否 | string | 代理类型，`http`（默认）或 `unix` |
| remark | 否 | string | 备注 |

> **说明**：主域名不能为泛解析（包含 `*`）。代理目标为 `https://` 时会自动开启 SNI。
> 若站点名已存在，会自动追加端口号后缀。


## 输出参数
| 参数名称 | 类型 | 描述 |
|----------|------|------|
| status | bool | 操作结果 |
| msg | string | 提示信息 |


## 示例

### 请求
```bash
curl -X POST "http://192.168.168.213:8888/mod/proxy/com/create/stype" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "domains=api.example.com&proxy_pass=http://127.0.0.1:3000&proxy_path=/&remark=API服务&request_time=...&request_token=..."
```

### 响应
```json
{
  "status": true,
  "msg": "反向代理项目添加成功！"
}
```

