Path: 宝塔面板 API 参考 › Proxy 反向代理

`POST /mod/proxy/com/set_global_websocket/stype`

开启或关闭反向代理站点的 WebSocket 协议支持。

## Request body

_Required._

- `opPostModProxyComSetGlobalWebsocketStype.request_time` (string, required) — Unix 时间戳；与接口密钥一起生成 request_token。
- `opPostModProxyComSetGlobalWebsocketStype.request_token` (string, required) — 按 API 概览中的双重 MD5 签名算法生成。
- `opPostModProxyComSetGlobalWebsocketStype.site_name` (string, required) — 站点名称
- `opPostModProxyComSetGlobalWebsocketStype.websocket_status/d` (integer, required) — 1 开启，0 关闭

## Example request

```text
{
  "request_time": "string",
  "request_token": "string",
  "site_name": "string",
  "websocket_status/d": 0
}
```

## Code samples

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

```curl
curl --request POST \
  --url "https://your-panel.example.com:8888/mod/proxy/com/set_global_websocket/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 "websocket_status/d=<websocket_status/d>" \
  --data-urlencode "action=set_global_websocket"
```

## Responses

### default

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

#### Example

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


## set_global_websocket

开启或关闭反向代理站点的 WebSocket 协议支持。

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

## 输入参数
| 参数名称 | 必选 | 类型 | 描述 |
|----------|------|------|------|
| site_name | 是 | string | 站点名称 |
| websocket_status/d | 是 | int | 1 开启，0 关闭 |

## 示例

### 请求
```bash
curl -X POST ".../mod/proxy/com/set_global_websocket/stype" \
  -d "site_name=example.com&websocket_status=1"
```

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

